This package is abandoned and no longer maintained. The author suggests using the mohamedhekal/lockguard package instead.

Safe distributed locking helpers for Laravel with owner tokens and job middleware

Maintainers

Package info

github.com/mohamedhekal/lockguard

pkg:composer/mohamedmohamedhekal/lockguard

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-07-16 14:23 UTC

This package is auto-updated.

Last update: 2026-07-16 14:40:22 UTC


README

CI License: MIT PHP Laravel

Search terms: laravel, redis, distributed-locks, concurrency, mutex, php, laravel-package, locking, cache-lock, jobs.

Safe distributed locking helpers for Laravel: with(), owner-aware cache locks, HTTP middleware, and queue WithoutOverlapping.

Installation

composer require mohamedhekal/lockguard
php artisan vendor:publish --tag=lockguard-config

Quick start

use Hekal\LockGuard\Facades\LockGuard;

LockGuard::with('inventory:sku-1', function () {
    // exclusive critical section
});

HTTP:

Route::middleware('lockguard:checkout:session,15')->post('/checkout', ...);

Queue:

public function middleware(): array
{
    return [new \Hekal\LockGuard\Support\WithoutOverlapping('sync:tenant-1')];
}

Notes

  • Uses Laravel cache locks. Prefer Redis in production.
  • default_wait_seconds=0 means fail fast (throw) when the lock is busy.
  • This is not Redlock multi-node consensus; it is a practical Laravel lock layer.

Testing

composer install && composer test

License

MIT