PHPackages                             tbachert/sync - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. tbachert/sync

ActiveLibrary[Queues &amp; Workers](/categories/queues)

tbachert/sync
=============

Synchronization primitives

v1.0.1(3mo ago)037Apache-2.0PHPPHP ^8.1

Since Dec 10Pushed 3mo ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (3)Used By (0)

Synchronization primitives
==========================

[](#synchronization-primitives)

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

[](#installation)

```
composer require tbachert/sync
```

Usage
-----

[](#usage)

### Example

[](#example)

```
$example = new Example();
await([
    async($example->increment(...), 5),
    async($example->increment(...), 4),
    async(fn() => var_dump($example->get())),
]);
var_dump($example->get());
// int(0)
// int(4)

$example = new ExampleSynchronized();
await([
    async($example->increment(...), 5),
    async($example->increment(...), 4),
    async(fn() => var_dump($example->get())),
]);
var_dump($example->get());
// int(9)
// int(9)

class Example {
    private int $value = 0;
    public function increment(int $count): void {
        $current = $this->value;
        delay(0);
        $this->value = $current + $count;
    }
    public function get(): int {
        return $this->value;
    }
}
class ExampleSynchronized {
    private Example $example;
    private ReadWriteLock $lock;
    public function __construct() {
        $this->example = new Example();
        $this->lock = new LocalReadWriteLock();
    }
    public function increment(int $count): void {
        synchronized(
            $this->lock->writeLock(),
            $this->example->increment(...), [$count],
        );
    }
    public function get(): int {
        return synchronized(
            $this->lock->readLock(),
            $this->example->get(...),
        );
    }
}
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance81

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

2

Last Release

102d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d96445384720ee37aa71d5ddd7b5a5d159558200b15b8a1b14e65e6095f2a7a?d=identicon)[tbachert](/maintainers/tbachert)

---

Top Contributors

[![Nevay](https://avatars.githubusercontent.com/u/22509671?v=4)](https://github.com/Nevay "Nevay (11 commits)")

---

Tags

asyncsynchronizationlock

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tbachert-sync/health.svg)

```
[![Health](https://phpackages.com/badges/tbachert-sync/health.svg)](https://phpackages.com/packages/tbachert-sync)
```

###  Alternatives

[amphp/amp

A non-blocking concurrency framework for PHP applications.

4.4k123.4M323](/packages/amphp-amp)[amphp/sync

Non-blocking synchronization primitives for PHP based on Amp and Revolt.

19052.8M39](/packages/amphp-sync)[amphp/parallel

Parallel processing component for Amp.

85046.2M74](/packages/amphp-parallel)[amphp/byte-stream

A stream abstraction to make working with non-blocking I/O simple.

393116.2M104](/packages/amphp-byte-stream)[revolt/event-loop

Rock-solid event loop for concurrent PHP applications.

92343.6M138](/packages/revolt-event-loop)[amphp/socket

Non-blocking socket connection / server implementations based on Amp and Revolt.

26539.0M119](/packages/amphp-socket)

PHPackages © 2026

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