PHPackages                             tarantool/symfony-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. [Caching](/categories/caching)
4. /
5. tarantool/symfony-lock

ActiveLibrary[Caching](/categories/caching)

tarantool/symfony-lock
======================

Symfony lock Tarantool store

0.2.10(2y ago)24.4k2MITPHPPHP &gt;=8.2CI failing

Since Jun 23Pushed 2y ago3 watchersCompare

[ Source](https://github.com/tarantool-php/symfony-lock)[ Packagist](https://packagist.org/packages/tarantool/symfony-lock)[ RSS](/packages/tarantool-symfony-lock/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (13)Used By (2)

Tarantool symfony-lock
======================

[](#tarantool-symfony-lock)

[![License](https://camo.githubusercontent.com/4124054880325e20d9dd3ecab749b639c2c49c4800927ac8fd66af0fb6aaa604/68747470733a2f2f706f7365722e707567782e6f72672f746172616e746f6f6c2f73796d666f6e792d6c6f636b2f6c6963656e73652e706e67)](https://packagist.org/packages/tarantool/symfony-lock)[![Latest Version](https://camo.githubusercontent.com/8c14006e571f3ce5a082477a1959473d7ffc80e65c8227568b7127d288c098f4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f746172616e746f6f6c2d7068702f73796d666f6e792d6c6f636b2e7376673f7374796c653d666c61742d737175617265)](https://github.com/tarantool-php/symfony-lock/releases)[![Total Downloads](https://camo.githubusercontent.com/ad9bfacc191164cf2975472396e0fb5e7b752e1d9590c423f37d6f564578e1f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746172616e746f6f6c2f73796d666f6e792d6c6f636b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tarantool/symfony-lock)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/da7472cc03c99c63fdf60e97d81849388725d21813a229899829df8a63bc7262/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746172616e746f6f6c2d7068702f73796d666f6e792d6c6f636b2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tarantool-php/symfony-lock/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/6a77bb7e110773f707cb01aaf2f6038417d1a6bf547fe2b0ff1ee916f45012a9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746172616e746f6f6c2d7068702f73796d666f6e792d6c6f636b2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tarantool-php/symfony-lock/?branch=master)[![Telegram](https://camo.githubusercontent.com/fcbb762172f6027f3e2f84b45d2f561a6c730200c819552f3cf384015c3c782f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54656c656772616d2d6a6f696e253230636861742d626c75652e737667)](https://t.me/tarantool_php)

About
=====

[](#about)

The `TarantoolStore` implements symfony `PersistingStoreInterface` using Tarantool Database.

Installation
============

[](#installation)

The recommended way to install the library is through [Composer](http://getcomposer.org):

```
$ composer require tarantool/symfony-lock

```

Prepare Tarantool
=================

[](#prepare-tarantool)

To start working on locking you need to create schema, the package contains schema manager that can be used for that. For additional documentation on client configuration see [tarantool/client repository](https://github.com/tarantool-php/client#creating-a-client).

```
use Tarantool\Client\Client;
use Tarantool\SymfonyLock\SchemaManager;

$client = Client::fromDefaults();
$schema = new SchemaManager($client);

// create spaces and indexes
$schema->setup();

// later if you want to cleanup lock space, use
$schema->tearDown();

// in addition you can configure TarantoolStore to create schema on demand
// pay attention, this option is false by default
$store = new TarantoolStore($client, [
    'createSchema' => true,
]);
```

Using Store
===========

[](#using-store)

For additional examples on lock factory usage follow [symfony/lock docs](https://symfony.com/doc/current/components/lock.html)

```
use Symfony\Component\Lock\LockFactory;
use Tarantool\Client\Client;
use Tarantool\SymfonyLock\TarantoolStore;

$client = Client::fromDefaults();
$store = new TarantoolStore($client);
$factory = new LockFactory($store);

$lock = $factory->createLock('pdf-invoice-generation');

if ($lock->acquire()) {
    // The resource "pdf-invioce-generation" is locked.
    // You can compute and generate invoice safely here.
    $lock->release();
}
```

Expiration helper
=================

[](#expiration-helper)

When key is expired it will be removed on acquiring new lock with same name. If your key names are not unique, you can use php cleaner to cleanup your database. The best way to cleanup data is start a fiber inside tarantool. For more details see [expirationd module documentation](https://github.com/tarantool/expirationd)

```
use Tarantool\Client\Client;
use Tarantool\SymfonyLock\Cleaner;

$client = Client::fromDefaults();
$cleaner = new Cleaner($client);

// cleanup keys that are expired
$cleaner->process();

// by default cleaner will process upto 100 items
// you can override it via optional configuration
$cleaner = new Cleaner($client, [
    'limit' => 10,
]);
```

Customization
=============

[](#customization)

Out of the box all classes are using space named `lock`. If you want - you can override it via options configuration. All available options and default values are listed below:

```
use Tarantool\Client\Client;
use Tarantool\SymfonyLock\Cleaner;
use Tarantool\SymfonyLock\SchemaManager;
use Tarantool\SymfonyLock\TarantoolStore;

$client = Client::fromDefaults();
$cleaner = new Cleaner($client, [
    'space' => 'lock',
    'limit' => '100',
]);

$schema = new SchemaManager($client, [
    'engine' => 'memtx',
    'space' => 'lock',
]);

$store = new TarantoolStore($client, [
    'space' => 'lock',
    'initialTtl' => 300,
    'createSchema' => false,
]);
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Recently: every ~191 days

Total

12

Last Release

949d ago

PHP version history (3 changes)0.1.0PHP ^7.4

0.2.5PHP &gt;=7.4

0.2.9PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d1208fadedf6b3356f8a5c7788d6d1533eb2c8838e166da0cf85f99722319d13?d=identicon)[nekufa](/maintainers/nekufa)

---

Top Contributors

[![nekufa](https://avatars.githubusercontent.com/u/405067?v=4)](https://github.com/nekufa "nekufa (18 commits)")

---

Tags

adapterdriverlockphpsymfonytarantoolclientnosqlpurelocktarantool

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tarantool-symfony-lock/health.svg)

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

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k332.8M3.0k](/packages/predis-predis)[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.2k](/packages/statamic-cms)[snc/redis-bundle

A Redis bundle for Symfony

1.0k41.4M77](/packages/snc-redis-bundle)[tarantool/mapper

PHP Object Mapper for Tarantool.

6865.0k4](/packages/tarantool-mapper)[tarantool/client

PHP client for Tarantool.

68460.2k23](/packages/tarantool-client)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M672](/packages/shopware-core)

PHPackages © 2026

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