PackageTrack
Sign in Get early access

malkusch/lock

Mutex library for exclusive code execution.

3.1.1 10M downloads/mo #1794 most downloaded on Packagist php-lock/lock

What this package is like to depend on

Last release 6 months ago

19 Feb 2026

Ships unpredictably

gaps range from 9 days to 2.6 years

Some releases are documented

notes for 7 of 20 stable releases

Nothing withdrawn

no release was ever pulled

11 years old

20 releases · first in 2015

1 release in the last 12 months

see the full history below

Release timeline

20 releases · Jul 2015 to Feb 2026
2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 20
  1. 3.1.1 19 Feb 2026
    Release notes

    Other changes

    • Add PHP 8.5 support (#83)

    Full Changelog: 3.1.0...3.1.1

    Upgrading notes

    For upgrading from 2.x version see 3.0.0 release notes.

    Open source →
  2. 3.1.0 28 Jul 2025
    Release notes

    Other changes

    • Add acquire timeout support to PostgreSQLMutex (#80)

    Full Changelog: 3.0.2...3.1.0

    Upgrading notes

    For upgrading from 2.x version see 3.0.0 release notes.

    Open source →
  3. 3.0.2 17 May 2025
    Release notes

    Other changes

    • Make AbstractLockMutex and Loop classes non-internal (#79)

    Full changelog: 3.0.1...3.0.2

    Upgrading notes

    For upgrading from 2.x version see 3.0.0 release notes.

    Open source →
  4. 3.0.1 17 Dec 2024
    Release notes

    Other changes

    • Add PHP 8.4 support (#58)

    Full changelog: 3.0.0...3.0.1

    Upgrading notes

    For upgrading from 2.x version see 3.0.0 release notes.

    Open source →
  5. 3.0.0 15 Dec 2024
    Release notes

    Major features - renamed namespace

    • Rename namespace to PascalCase (#65)

    Rename all FQCN uses from camelCase to PascalCase like malkusch\lock\mutex\Mutex to Malkusch\Lock\Mutex\Mutex.

    Major features - renamed namespace

    • Merge Redis mutex implementations into single RedisMutex class (#69)
    • Introduce DistributedMutex class (#75)

    In 2.x version, there were two PHPRedisMutex and PredisMutex classes. They were almost a duplicate of each other and both have implemented RedLock distributed lock when more than 1 Redis client instance was passed to the constructor.

    Newly, in 3.x version, both class were unified into one RedisMutex class supporting both PHP redis and Predis clients. In addition, the constructor newly accepts only single Redis client instance.

    When distributed lock is wanted, use new DistributedMutex class which newly accepts any AbstractSpinlockMutex class which is currently implemented by RedisMutex and MemcachedMutex. This change allows you to create distributed lock across different backends.

    Major features - other

    • Introduce AbstractSpinlockWithTokenMutex class (#72)
    • Add fail callback support in DoubleCheckedLocking::then() method (#76)

    Newly we strictly distinguish between:
    - "acquire timeout" (timeout before the library give up trying to acquire a lock for your code)
    - and "expire timeout" (timeout after the lock expires on the, possibly remote, store).

    Breaking changes

    • Unify lock/unlock methods visibility (#62)
    • Prefix MySQL and PostgreSQL mutex name (#63, #64)
    • Remove CASMutex class (#67)
    • Improve abstract mutex classes naming (#68)
    • Rename TimeoutException to LockAcquireTimeoutException (#70)
    • Remove TransactionalMutex class (#73)
    • Rename NoMutex class to NullMutex (#74)

    Other changes

    • Internal LockUtil class was added to deduplicate the code (70fd6d9)
    • Fix float to int casting and improve timeout names (#71)
    • Improve distributed locking (#77)
    • Fix pcntl_signal() restore when pcntl_alarm() is set (4fe9681)

    Full changelog: 2.3.0...3.0.0

    Open source →
  6. 2.3.0 05 Dec 2024
    Release notes

    Major features

    • Add support for fractional seconds timeout (#55)

    Other changes

    • Drop PHP 7.2 and PHP 7.3 support (b10b0a0)
    • Emit exceptions without "." at the end (515250e)
    • Improve RedisMutex token randomness (a98afa2)

    Full changelog: 2.2.1...2.3.0

    Open source →
  7. v2.2.1 26 Apr 2022
    Release notes
    Open source →
  8. 1.0.0 05 Aug 2016

    Nothing published for this version

  9. 0.2.1 27 Jul 2015

    Nothing published for this version

  10. v2.2 07 Mar 2021

    Nothing published for this version

  11. v2.1 12 Dec 2018

    Nothing published for this version

  12. v2.0 08 Nov 2018

    Nothing published for this version

  13. v1.4 07 Jul 2018

    Nothing published for this version

  14. v1.3 26 May 2018

    Nothing published for this version

  15. v1.2 21 May 2018

    Nothing published for this version

  16. v1.1 15 Apr 2018

    Nothing published for this version

  17. 0.4 11 Aug 2015

    Nothing published for this version

  18. 0.3 31 Jul 2015

    Nothing published for this version

  19. 0.2 24 Jul 2015

    Nothing published for this version

  20. 0.1 12 Jul 2015

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive