PHPackages                             kitpages/semaphore-bundle - 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. kitpages/semaphore-bundle

ActiveSymfony-bundle

kitpages/semaphore-bundle
=========================

This is a Symfony2 bundle that provides a semaphore system.

v2.0.0(9y ago)107.4k2[1 issues](https://github.com/kitpages/KitpagesSemaphoreBundle/issues)1MITPHPPHP &gt;=5.6

Since Dec 5Pushed 9y ago3 watchersCompare

[ Source](https://github.com/kitpages/KitpagesSemaphoreBundle)[ Packagist](https://packagist.org/packages/kitpages/semaphore-bundle)[ Docs](https://github.com/kitpages/KitpagesSemaphoreBundle)[ RSS](/packages/kitpages-semaphore-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (9)Versions (7)Used By (1)

KitpagesSemaphoreBundle
=======================

[](#kitpagessemaphorebundle)

[![Build Status](https://camo.githubusercontent.com/e875e9b303bd1f0249cf44b6a6088f4fc2cf5f5ab1736446fb1664ebf83b7df4/68747470733a2f2f7472617669732d63692e6f72672f6b697470616765732f4b6974706167657353656d6170686f726542756e646c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/kitpages/KitpagesSemaphoreBundle)

[![SensioLabsInsight](https://camo.githubusercontent.com/f837e65270761fbf68d9aa7be7736afcb0d56219a488e60e2238bbb99070f3f6/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f65366334613336332d363330642d343033362d386337332d6239333430376630383034332f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/e6c4a363-630d-4036-8c73-b93407f08043)

This bundle allows a protection between several parallel php process accessing a single resource

quick start
-----------

[](#quick-start)

```
// get manager
$semaphoreManager = $this->get("kitpages_semaphore.manager");

// wait for the semaphore disponibility
$semaphoreManager->aquire("my_semaphore_name");

// do someting interesting with the protected resource

// release the semaphore
$semaphoreManager->release("my_semaphore_name");
```

Features
--------

[](#features)

- shared semaphore between several parallel php processes (using the filesystem)
- deadlock detection : consider a semaphore as dead after a configurable duration
- logging system for deadlock on a specific channel in monolog (channel : kitpages\_semaphore)
- stopwatch to see semaphore usage in the timeline of the symfony debug toolbar

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

[](#installation)

---

Using [Composer](http://getcomposer.org/), just `$ composer require kitpages/semaphore-bundle` package or:

```
{
  "require": {
    "kitpages/semaphore-bundle": "~1.4"
  }
}
```

Then add the bundle in AppKernel :

```
    public function registerBundles()
    {
        $bundles = array(
            // ...
            // use of monolog
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            // the bundle itself
            new Kitpages\SemaphoreBundle\KitpagesSemaphoreBundle(),
        );
    }
```

The add configuration in your config.yml.

Default values are 0.1s for pooling sleep time and 5s for deadlock duration

```
kitpages_semaphore:
    sleep_time_microseconds: 100000
    dead_lock_microseconds: 5000000
```

Status
------

[](#status)

- stable, tested and under travis-ci

Versions
--------

[](#versions)

2014-02-11 : v1.4.0 : addded semaphore usage in the timeline of the SF2 debug toolbar

- no BC break
- new : added stopwatch to add semaphore usage in the timeline of the SF2 debug toolbar
- new : debug log less verbose
- new : warning log added on release on a not locked semaphore

2014-01-22 : v1.3.0 : refactoring based on file lock

- no BC break
- used file lock instead of SQL transaction

2014-01-14 : v1.2.0 : logger for dead lock

- no BC break
- new : use monolog on the channel "kitpages\_semaphore" to send a warning for every deadlock
- fix : dependencies in composer.json
- enh : more unit testing for configuration parser and service initialisation in the DIC
- enh : Readme rewriting

2013-12-11 : v1.1.0 : atomicity in aquire-release process

- no BC Break
- new : add a db transaction around the aquire-release process to garanty atomicity

2013-12-05 : v1.0.0 : first release

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 80.6% 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 ~240 days

Recently: every ~299 days

Total

6

Last Release

3339d ago

Major Versions

v1.4.0 → v2.0.02017-03-24

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.2

v2.0.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/95c1423b83010cc8afd1fc966d26cc6fc5d7fb5d000e5d7582adcd8392bd239c?d=identicon)[kitpages](/maintainers/kitpages)

---

Top Contributors

[![philippe-levan](https://avatars.githubusercontent.com/u/393066?v=4)](https://github.com/philippe-levan "philippe-levan (25 commits)")[![antspk](https://avatars.githubusercontent.com/u/78955792?v=4)](https://github.com/antspk "antspk (2 commits)")[![hugues-m](https://avatars.githubusercontent.com/u/5310915?v=4)](https://github.com/hugues-m "hugues-m (2 commits)")[![eliecharra](https://avatars.githubusercontent.com/u/6154987?v=4)](https://github.com/eliecharra "eliecharra (1 commits)")[![sobit](https://avatars.githubusercontent.com/u/1245542?v=4)](https://github.com/sobit "sobit (1 commits)")

---

Tags

semaphorelock

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kitpages-semaphore-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/kitpages-semaphore-bundle/health.svg)](https://phpackages.com/packages/kitpages-semaphore-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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