PHPackages                             dakota/redlock-php - 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. dakota/redlock-php

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

dakota/redlock-php
==================

Redis distributed locks in PHP

v1.1.0(8y ago)055.2kMITPHPPHP &gt;=5.4.0

Since Feb 23Pushed 8y agoCompare

[ Source](https://github.com/dakota/redlock-php)[ Packagist](https://packagist.org/packages/dakota/redlock-php)[ RSS](/packages/dakota-redlock-php/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (1)Versions (12)Used By (0)

redlock-php - Redis distributed locks in PHP

- Forked from [redlock-php](https://github.com/ronnylt/redlock-php) by [Ronny Lopez](https://github.com/ronnylt)
- Based on [Redlock-rb](https://github.com/antirez/redlock-rb) by [Salvatore Sanfilippo](https://github.com/antirez)

This library implements the Redis-based distributed lock manager algorithm [described on the Redis website](https://redis.io/topics/distlock).

It relies on [Credis](https://github.com/colinmollenhour/credis) for Redis connections. Credis offers a native pure-PHP implementation which will automatically switch to using [phpredis](https://github.com/phpredis/phpredis) for improved performance if it's available.

To create a lock manager:

```
$servers = [
    ['127.0.0.1', 6379, 0.01],
    ['127.0.0.1', 6389, 0.01],
    ['127.0.0.1', 6399, 0.01],
];

$redLock = new RedLock($servers);
```

To acquire a lock:

```
$lock = $redLock->lock('my_resource_name', 1000);
```

Where the resource name is an unique identifier of what you are trying to lock and 1000 is the number of milliseconds for the validity time.

The returned value is `false` if the lock was not acquired (you may try again), otherwise an array representing the lock is returned, having three keys:

```
Array
(
    [validity] => 9897.3020019531
    [resource] => my_resource_name
    [token] => 53771bfa1e775
)
```

- validity, an integer representing the number of milliseconds the lock will be valid.
- resource, the name of the locked resource as specified by the user.
- token, a random token value which is used to safe reclaim the lock.

To release a lock:

```
    $redLock->unlock($lock)
```

It is possible to setup the number of retries (by default 3) and the retry delay (by default 200 milliseconds) used to acquire the lock.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~82 days

Total

10

Last Release

3008d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/83255?v=4)[Walther Lalk](/maintainers/dakota)[@dakota](https://github.com/dakota)

---

Top Contributors

[![dakota](https://avatars.githubusercontent.com/u/83255?v=4)](https://github.com/dakota "dakota (3 commits)")[![ronnylt](https://avatars.githubusercontent.com/u/24546?v=4)](https://github.com/ronnylt "ronnylt (3 commits)")[![consolibyte](https://avatars.githubusercontent.com/u/248989?v=4)](https://github.com/consolibyte "consolibyte (1 commits)")[![joni2back](https://avatars.githubusercontent.com/u/2049935?v=4)](https://github.com/joni2back "joni2back (1 commits)")[![sp-ronny-lopez](https://avatars.githubusercontent.com/u/6653187?v=4)](https://github.com/sp-ronny-lopez "sp-ronny-lopez (1 commits)")[![zeroasterisk](https://avatars.githubusercontent.com/u/23422?v=4)](https://github.com/zeroasterisk "zeroasterisk (1 commits)")

### Embed Badge

![Health badge](/badges/dakota-redlock-php/health.svg)

```
[![Health](https://phpackages.com/badges/dakota-redlock-php/health.svg)](https://phpackages.com/packages/dakota-redlock-php)
```

###  Alternatives

[magento/community-edition

Magento 2 (Open Source)

12.1k53.0k12](/packages/magento-community-edition)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[scandipwa/persisted-query

ScandiPWA persisted query module

12248.7k3](/packages/scandipwa-persisted-query)[fractas/elemental-stylings

Collection of useful and reusable SilverStripe Elemental stylings properties

1416.5k1](/packages/fractas-elemental-stylings)

PHPackages © 2026

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