PHPackages                             code-orange/redis-counting-semaphore - 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. code-orange/redis-counting-semaphore

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

code-orange/redis-counting-semaphore
====================================

Distributed counting semaphore implementation for redis

v1.2(5y ago)654.9k↓37.5%5[2 PRs](https://github.com/code-orange/redis-counting-semaphore/pulls)Apache-2.0PHP

Since Mar 13Pushed 1y ago3 watchersCompare

[ Source](https://github.com/code-orange/redis-counting-semaphore)[ Packagist](https://packagist.org/packages/code-orange/redis-counting-semaphore)[ RSS](/packages/code-orange-redis-counting-semaphore/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (7)Used By (0)

Redis counting semaphore [![Latest Stable Version](https://camo.githubusercontent.com/0d007ca480ca67259c38aab3c79d35d79914e5897f9adb49a4ae66e38bba4da4/68747470733a2f2f706f7365722e707567782e6f72672f636f64652d6f72616e67652f72656469732d636f756e74696e672d73656d6170686f72652f762f737461626c65)](https://packagist.org/packages/code-orange/redis-counting-semaphore) [![Total Downloads](https://camo.githubusercontent.com/c94d6598c870a59080a58c10518106057b9c2a07e375e767c3e61b40d66f6572/68747470733a2f2f706f7365722e707567782e6f72672f636f64652d6f72616e67652f72656469732d636f756e74696e672d73656d6170686f72652f646f776e6c6f616473)](https://packagist.org/packages/code-orange/redis-counting-semaphore) [![License](https://camo.githubusercontent.com/f3c0c0b8e3ca9d64767f7a2263d9d059bb9c9def44ae0052eb50cc66813e53a2/68747470733a2f2f706f7365722e707567782e6f72672f636f64652d6f72616e67652f72656469732d636f756e74696e672d73656d6170686f72652f6c6963656e7365)](https://packagist.org/packages/code-orange/redis-counting-semaphore) [![composer.lock](https://camo.githubusercontent.com/ec7ad6d676a1af7ced97c58cf646d8abe2959be1f1fc362e371510e8e93ec2ef/68747470733a2f2f706f7365722e707567782e6f72672f636f64652d6f72616e67652f72656469732d636f756e74696e672d73656d6170686f72652f636f6d706f7365726c6f636b)](https://packagist.org/packages/code-orange/redis-counting-semaphore)
============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#redis-counting-semaphore----)

`redis-counting-semaphore` is a package with a counting semaphore implementation for PHP. It uses redis as a central broker.

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

[](#installation)

To install redis-counting-semaphore with composer:

```
composer require code-orange/redis-counting-semaphore

```

Usage
=====

[](#usage)

First, make sure you have a [Predis](https://github.com/nrk/predis) connection instance.

You can create and attempt to obtain a semaphore like so:

```
