PHPackages                             neovg/phpredis-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. neovg/phpredis-lock

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

neovg/phpredis-lock
===================

Simple mutex locking class with support for TTL using PHPRedis as backend.

1.0.4(4y ago)19.0kBSD-3-ClausePHPPHP &gt;=7.4CI failing

Since Mar 28Pushed 4y ago1 watchersCompare

[ Source](https://github.com/NeoVG/phpredis-lock)[ Packagist](https://packagist.org/packages/neovg/phpredis-lock)[ Docs](https://github.com/NeoVG/phpredis-lock)[ RSS](/packages/neovg-phpredis-lock/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

phpredis-lock
=============

[](#phpredis-lock)

Simple mutex locking class with support for TTL using PHPRedis as backend.

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

[](#installation)

```
composer require neovg/phpredis-lock
```

Setup
-----

[](#setup)

```
\NeoVg\PhpRedisLock\Lock::getInstance()->setConfig(
    (new \NeoVg\PhpRedisLock\ConfigStruct())
        ->withHost('127.0.0.1')
        ->withPort(6379)
        ->withDatabase(11)
);
```

Usage
-----

[](#usage)

### Acquire and release

[](#acquire-and-release)

```
if (!\NeoVg\PhpRedisLock\Lock::getInstance()->acquire('name')) {
    echo 'could not acquire lock';
}

if (!\NeoVg\PhpRedisLock\Lock::getInstance()->release('name')) {
    echo 'could not release lock';
}
```

#### Non blocking acquire

[](#non-blocking-acquire)

```
\NeoVg\PhpRedisLock\Lock::getInstance()->acquire('name', 0);
```

#### Custom wait time (120 seconds)

[](#custom-wait-time-120-seconds)

```
\NeoVg\PhpRedisLock\Lock::getInstance()->acquire('name', 120);
```

#### TTL (60 seconds)

[](#ttl-60-seconds)

```
\NeoVg\PhpRedisLock\Lock::getInstance()->acquire('name', null, 60);
```

### Check if already acquired (by this process)

[](#check-if-already-acquired-by-this-process)

```
\NeoVg\PhpRedisLock\Lock::getInstance()->isAcquired('name');
```

### Check if already locked (by another process)

[](#check-if-already-locked-by-another-process)

```
\NeoVg\PhpRedisLock\Lock::getInstance()->isLocked('name');
```

### Get info about existing lock

[](#get-info-about-existing-lock)

```
$lockInfo = \NeoVg\PhpRedisLock\Lock::getInstance()->get('name;);
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~205 days

Total

4

Last Release

1663d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3821e127ce35b3463b699a9f3054e31fad5e8149643493b75733bbec5552e0a5?d=identicon)[NeoVg](/maintainers/NeoVg)

---

Top Contributors

[![NeoVG](https://avatars.githubusercontent.com/u/4890318?v=4)](https://github.com/NeoVG "NeoVG (7 commits)")

---

Tags

mutexlockingprocess-management

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/neovg-phpredis-lock/health.svg)

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

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514135.1M625](/packages/symfony-lock)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

5.0k4.9k](/packages/shlinkio-shlink)[pudongping/hyperf-wise-locksmith

A mutex library provider for the Hyperf framework, designed to enable serialized execution of PHP code in high-concurrency scenarios.

107.1k2](/packages/pudongping-hyperf-wise-locksmith)

PHPackages © 2026

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