PHPackages                             mauretto78/locker-manager - 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. mauretto78/locker-manager

ActiveLibrary

mauretto78/locker-manager
=========================

Locker Manager

v1.0.6(8y ago)14561MITPHPPHP ^5.6 || ^7.0

Since Nov 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mauretto78/locker-manager)[ Packagist](https://packagist.org/packages/mauretto78/locker-manager)[ Docs](https://github.com/mauretto78/locker-manager)[ RSS](/packages/mauretto78-locker-manager/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (8)Used By (0)

Simple Locker Manager
=====================

[](#simple-locker-manager)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/400939655096a63e868c4e02ed20df2aaef40497c7510b3eb22f8f0efef95029/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6175726574746f37382f6c6f636b65722d6d616e616765722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mauretto78/locker-manager/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/f043c36d07e0447f3d6673db5fdc8073178700a591206324b58c62e567374c14/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6230323738653262356239623466656238663930373833323664333732316664)](https://www.codacy.com/app/mauretto78/locker-manager?utm_source=github.com&utm_medium=referral&utm_content=mauretto78/locker-manager&utm_campaign=Badge_Grade)![license](https://camo.githubusercontent.com/49840c85ca419db8cb99b0a5d4b947c08a311275239470a372a9493a6d6958d2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6175726574746f37382f73696d706c652d6576656e742d73746f72652d6d616e616765722e737667)![Packagist](https://camo.githubusercontent.com/307a0151349b51cdfe6a8b82b8a3587be409fa53eb82c03839dca0d3e2117fd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6175726574746f37382f73696d706c652d6576656e742d73746f72652d6d616e616765722e737667)

This library is suitable for you if you need to simple lock system.

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

[](#installation)

```
composer require mauretto78/locker-manager

```

Basic Usage
-----------

[](#basic-usage)

### Instantiate LockerManager

[](#instantiate-lockermanager)

To instantiate the LockerManager you must inject an implementation of `LockerStoreInterface`. You can use:

- `FLockerStore`
- `PdoLockerStore`
- `RedisLockerStore`

Take a look:

```
use LockerManager\Application\LockerManager;
use LockerManager\Infrastructure\FLockerStore;
use LockerManager\Infrastructure\PdoLockerStore;
use LockerManager\Infrastructure\RedisLockerStore;
use Predis\Client;

// Filesystem implementation
$fLockerStore = new FLockerStore('var/lock/');
$lockerManager = new LockerManager($fLockerStore);
```

```
// ..

// PDO implementation
$pdoLockerStore = new PdoLockerStore(new \PDO($config));
$lockerManager = new LockerManager($pdoLockerStore);
```

```
// ..

// Redis implementation uses PRedis Client
$redisLockerStore = new RedisLockerStore(new Client($config));
$lockerManager = new LockerManager($redisLockerStore);
```

### Acquire, get, delete and update a lock

[](#acquire-get-delete-and-update-a-lock)

This library uses [Slugify](https://github.com/cocur/slugify) to save lock keys.

Once a key is saved, this will be unique. An `ExistingKeyException` will be thrown if you try to save a lock with the same key.

Please consider this example:

```
// ..

// acquire
$lock = new Lock(
    'Sample Lock',
    [
        'name' => 'John Doe',
        'email' => 'john.doe@gmail.com',
        'age' => 33,
    ]
);

$lockerManager->acquire($lock);

// get a lock
$sampleLock = $lockerManager->get('Sample Lock');

// delete a lock
$lockerManager->delete('Sample Lock');

// update a lock
$lockerManager->update(
    'Sample Lock',
    [
        'name' => 'Maria Dante',
        'email' => 'maria.dante@gmail.com',
        'age' => 31,
    ]
);
```

### Get all locks

[](#get-all-locks)

To get all saved locks as an array:

```
// ..

$lockerManager->getAll();
```

### Clear all locks

[](#clear-all-locks)

To clear all locks:

```
// ..

$lockerManager->clear();
```

Support
-------

[](#support)

If you found an issue or had an idea please refer [to this section](https://github.com/mauretto78/locker-manager/issues).

Authors
-------

[](#authors)

- **Mauro Cassani** - [github](https://github.com/mauretto78)

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity63

Established project with proven stability

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 ~2 days

Total

7

Last Release

3096d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a9a5d92c7a88371bdc4b5f7fb7ff9c4fe890289b970d53486ca455700614df7?d=identicon)[mauretto78](/maintainers/mauretto78)

---

Tags

locklocker-managerphpphp-libraryphplock

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/mauretto78-locker-manager/health.svg)

```
[![Health](https://phpackages.com/badges/mauretto78-locker-manager/health.svg)](https://phpackages.com/packages/mauretto78-locker-manager)
```

###  Alternatives

[yriveiro/php-fslock

A simple lock implementation using flock.

18101.8k](/packages/yriveiro-php-fslock)[wandesnet/mercadopago-laravel

PHP SDK for integration with Mercado Pago

252.4k](/packages/wandesnet-mercadopago-laravel)

PHPackages © 2026

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