PHPackages                             yusitnikov/php-elock-client - 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. yusitnikov/php-elock-client

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

yusitnikov/php-elock-client
===========================

Simple eLock client on PHP

1.2.1(1y ago)090MITPHP

Since Jul 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yusitnikov/php-elock-client)[ Packagist](https://packagist.org/packages/yusitnikov/php-elock-client)[ RSS](/packages/yusitnikov-php-elock-client/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

PHP eLock Client
================

[](#php-elock-client)

Simple eLock client on PHP. Also supports features of NodeJS eLock server.

What is eLock?
--------------

[](#what-is-elock)

eLock is a simple distributed lock server on erlang.

Advantages:

- fault-tolerant
- simple to install and to use
- safe from race conditions - all operations are atomic
- all locks required by a client are being unlocked automatically when the client disconnects

See [source repository](https://github.com/dustin/elock).

What is NodeJS eLock server?
----------------------------

[](#what-is-nodejs-elock-server)

NodeJS eLock server is an implementation of original eLock protocol on NodeJS with an addition of deadlock detection.

Advantages:

- all advantages of original eLock protocol
- when lock attempt causes a recursive lock circle, a deadlock is automatically reported with 423 response code
- supports value locks
- has "debug" command

See [source repository](https://github.com/yusitnikov/node-elock-server).

Install eLock server
--------------------

[](#install-elock-server)

### Original eLock server

[](#original-elock-server)

1. [Install erlang OTP](https://hostpresto.com/community/tutorials/how-to-install-erlang-on-ubuntu-16-04/)
2. [Install and run eLock server](http://dustin.sallings.org/elock/admin.html)

### NodeJS eLock server

[](#nodejs-elock-server)

1. [Install NodeJS/npm](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)
2. [Install and run eLock server](https://github.com/yusitnikov/node-elock-server#install)

It would be listening on port 11400.

Install eLock client
--------------------

[](#install-elock-client)

The client is available as a composer dependency:

```
composer install yusitnikov/php-elock-client
```

Use eLock client
----------------

[](#use-elock-client)

### Basic usage

[](#basic-usage)

```
$key1 = 'unique-resource-key1';
$key1 = 'unique-resource-key2';
$lockTimeout = 5;

// Create a client of an original eLock server
$client = new ELockClient('your.elock.server.host.or.ip');
// or create a client of a NodeJS eLock server
$client = new ELockClientEx('your.elock.server.host.or.ip');

// Tell to release all locks after the disconnection
$client->setTimeout(0);

// Lock keys
$lockedKey1 = $client->lock($key1, $lockTimeout);
$lockedKey2 = $client->lock($key2, $lockTimeout);

// Unlock key
$unlockedKey1 = $client->unlock($key1);

// Unlock all keys you own
$client->unlockAll();

// Disconnect from the server
$client->quit();
$client->close();
```

### Common usage for atomic operations

[](#common-usage-for-atomic-operations)

```
// Lock the resource with a timeout that's big enough to wait for other clients to finish their job
if (!$client->lock($key, $timeout)) {
    throw new Exception('Failed to lock the resource XXX during YYY seconds');
}

try {
    // Do something with the locked resource
} finally {
    // Ensure that the resource will be unlocked in the case of unexpected error
    $client->unlock($key);
}
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~433 days

Recently: every ~541 days

Total

6

Last Release

680d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/58d76ba9d11931a4350c64c6b878ccf7b28f40c3a98ac7cc651d9fdc80a3162a?d=identicon)[yusitnikov](/maintainers/yusitnikov)

---

Top Contributors

[![ysitnikov](https://avatars.githubusercontent.com/u/13730673?v=4)](https://github.com/ysitnikov "ysitnikov (6 commits)")[![muli](https://avatars.githubusercontent.com/u/1042806?v=4)](https://github.com/muli "muli (1 commits)")[![yusitnikov](https://avatars.githubusercontent.com/u/13732463?v=4)](https://github.com/yusitnikov "yusitnikov (1 commits)")

### Embed Badge

![Health badge](/badges/yusitnikov-php-elock-client/health.svg)

```
[![Health](https://phpackages.com/badges/yusitnikov-php-elock-client/health.svg)](https://phpackages.com/packages/yusitnikov-php-elock-client)
```

###  Alternatives

[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[j0k3r/php-readability

Automatic article extraction from HTML

186808.8k6](/packages/j0k3r-php-readability)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[symfony/ai-agent

PHP library for building agentic applications.

30536.7k44](/packages/symfony-ai-agent)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)

PHPackages © 2026

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