PHPackages                             snowio/magento2-lock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. snowio/magento2-lock

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

snowio/magento2-lock
====================

A Magento 2 module which provides a multi-server lock service

v1.4.0(5y ago)7216.3k↓43.8%4[1 issues](https://github.com/snowio/magento2-lock/issues)4MITPHPPHP &gt;=7

Since Oct 25Pushed 5y ago5 watchersCompare

[ Source](https://github.com/snowio/magento2-lock)[ Packagist](https://packagist.org/packages/snowio/magento2-lock)[ RSS](/packages/snowio-magento2-lock/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (9)Used By (4)

Magento 2 Lock
==============

[](#magento-2-lock)

Description
-----------

[](#description)

A Magento 2 module which provides a multi-server lock service. This allows developers to apply mutual exclusion locks to shared resources so that they are not accessed simultaneously.

Prerequisites
-------------

[](#prerequisites)

- PHP 7.0 or newer.
- `magento/framework` module 100 or newer.
- Composer ().

Installation
------------

[](#installation)

```
composer require snowio/magento2-lock
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

```

Usage
-----

[](#usage)

The lock service can be accessed through dependency injection. Please refer the [dependency injection](http://devdocs.magento.com/guides/v2.0/extension-dev-guide/depend-inj.html) section of the [Magento DevDocs](http://devdocs.magento.com) for more information on how to use dependency injection.

### `public boolean LockService::acquireLock(string $name, int $timeout)`

[](#public-boolean-lockserviceacquirelockstring-name-int-timeout)

Attempt to obtain a lock ####Parameters

- `$lockName` : The lock identifier/name
- `$timeout` : Lock timeout. A negative timeout implies an infinite timeout.

\####Return Values A boolean indicating if the the lock was acquired.

### `public LockService::releaseLock($lockName)`

[](#public-lockservicereleaselocklockname)

Release the lock

#### Parameters

[](#parameters)

- `$lockName` : The lock identifier/name

### Example

[](#example)

```
namespace Vendor\Module\Model\Accessors;
class ResourceAccessor
{
    private $lockService;

    public function __construct(
        SnowIO\Lock\Api\LockService $lockService
    ) {
        $this->lockService = $lockService
    }

    public function access($resource)
    {
        $lockName = //.. resource lock name

        //try acquire the lock
        if (!$this->lockService->acquireLock($lockName, 0)) {
            //Lock was not acquired ...
        }
        //Lock was acquired

        try {
            // Process $resource
        } finally {
            //release the lock
            $this->lockService->releaseLock($lockName);
        }

    }
}
```

Applications
------------

[](#applications)

- [snowio/magento2-product-save-mutex](https://github.com/snowio/magento2-product-save-mutex) : Uses this module in order to make product save API calls mutually exclusive.
- [snowio/magento2-idempotent-api](https://github.com/snowio/magento2-idempotent-api) : Uses this module in order to determine request conflicts whereby 2 or more requests that have the same `X-Message-Group-ID` are dispatched.

License
-------

[](#license)

This software is licensed under the MIT License. [View the license](LICENSE)

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~298 days

Recently: every ~344 days

Total

6

Last Release

2001d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aa904d0f61196b12bd6727175110ad7a58e19d888960279e7e4b9dbb636f34b9?d=identicon)[convenient](/maintainers/convenient)

![](https://www.gravatar.com/avatar/248c125feb1acc5c8932c06226dcd5086760736ff5fc9ec69be32a3aeae8a339?d=identicon)[chickenland](/maintainers/chickenland)

---

Top Contributors

[![joshdifabio](https://avatars.githubusercontent.com/u/5609851?v=4)](https://github.com/joshdifabio "joshdifabio (8 commits)")[![convenient](https://avatars.githubusercontent.com/u/600190?v=4)](https://github.com/convenient "convenient (2 commits)")[![darryla](https://avatars.githubusercontent.com/u/12641702?v=4)](https://github.com/darryla "darryla (2 commits)")

### Embed Badge

![Health badge](/badges/snowio-magento2-lock/health.svg)

```
[![Health](https://phpackages.com/badges/snowio-magento2-lock/health.svg)](https://phpackages.com/packages/snowio-magento2-lock)
```

###  Alternatives

[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2091.2M7](/packages/yireo-magento2-webp2)[tig/postnl-magento2

TIG Magento 2 PostNL extension

58544.2k4](/packages/tig-postnl-magento2)[lillik/magento2-price-decimal

Magento 2 Price Decimal Precision

111147.5k](/packages/lillik-magento2-price-decimal)[nosto/module-nostotagging

Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.

27659.1k4](/packages/nosto-module-nostotagging)[magepal/magento2-customeraccountlinksmanager

Customer Account Links Manager for Magento2 allows you to quickly and easily remove unwanted links from customer account dashboard

4084.9k](/packages/magepal-magento2-customeraccountlinksmanager)[doofinder/doofinder-magento2

Doofinder module for Magento 2

13204.0k1](/packages/doofinder-doofinder-magento2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
