PHPackages                             tigron/skeleton-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. tigron/skeleton-lock

ActiveLibrary

tigron/skeleton-lock
====================

Atomic locking for skeleton

v1.0.5(5mo ago)01.4k↓30%1MITPHPPHP &gt;=8.2

Since Aug 11Pushed 5mo agoCompare

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

READMEChangelog (6)DependenciesVersions (7)Used By (1)

skeleton-lock
=============

[](#skeleton-lock)

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

[](#description)

Various locking mechanisms, providing atomic locks.

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

[](#installation)

Installation via composer:

```
composer require tigron/skeleton-lock

```

Configuration
-------------

[](#configuration)

In the default case, `skeleton-lock` assumes it is running an application on a single node, and using an RDBMS which supports locks (e.g. MySQL/ MariaDB's `GET_LOCK()`).

However, this is not always supported, for example when running a clustered database.

The following mechanisms are supported:

- database (default)
- file
- memcache
- memcached

This can be configured via `Config`:

```
\Skeleton\Lock\Config::$locking = 'database';

```

Of course, each mechanism requires the supporting skeleton package to be installed as well, and requires the settings for that specific mechanism to be defined.

```
\Skeleton\Object\Config::$cache_handler_config = [
	'hostname' => '127.0.0.1', // memcache/memcached
	'port' => '12211', // memcache/memcached
	'dsn' => 'mysqli://user@database/table', // database
	'path' => '/path/', // file
	'expire' => 10, // not supported for database
];

```

Note that not all mechanisms support all features. For example, database locks can not expire.

Usage
-----

[](#usage)

For getting a lock, you can either call `obtain()` or `wait()`, where the former will fail immediately if it can not get a lock, and the latter will retry until the specified timeout expired.

Releasing a lock is done with `release()`.

### Examples

[](#examples)

Get the current handler, and wait for 5 seconds to acquire `mylock`:

```
\Skeleton\Lock\Handler::get()::wait('mylock', wait: 5);

```

Get the current handler, get `mylock` immediately and deal with potential failure:

```
try {
	$lock = \Skeleton\Lock\Handler::get();
	$lock::obtain('mylock');
} catch (\Skeleton\Lock\Exception\Failed $e) {
	echo 'Could not get the lock';
}

```

Releasing the lock we got earlier:

```
$lock::release('mylock');

```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance72

Regular maintenance activity

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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

Recently: every ~29 days

Total

6

Last Release

161d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bff1383483dacb0c3f89d2d3856ae03d4cf3e80de26a2998248dd1175317285?d=identicon)[tigron](/maintainers/tigron)

---

Top Contributors

[![gerryd](https://avatars.githubusercontent.com/u/3003371?v=4)](https://github.com/gerryd "gerryd (6 commits)")

### Embed Badge

![Health badge](/badges/tigron-skeleton-lock/health.svg)

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

PHPackages © 2026

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