PHPackages                             mohamedhekal/lockguard - 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. [Caching](/categories/caching)
4. /
5. mohamedhekal/lockguard

ActiveLibrary[Caching](/categories/caching)

mohamedhekal/lockguard
======================

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

v0.1.0(1mo ago)00MITPHPPHP ^8.2CI passing

Since Jul 16Pushed 1mo agoCompare

[ Source](https://github.com/mohamedhekal/lockguard)[ Packagist](https://packagist.org/packages/mohamedhekal/lockguard)[ Docs](https://github.com/mohamedhekal/lockguard)[ RSS](/packages/mohamedhekal-lockguard/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

LockGuard
=========

[](#lockguard)

[![CI](https://github.com/mohamedhekal/lockguard/actions/workflows/tests.yml/badge.svg)](https://github.com/mohamedhekal/lockguard/actions)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/c2588b5670f2c910b8cc849ace22a22efda8956b7c2f797d11d2096bbfc7b1f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d3737374242342e737667)](https://www.php.net/)[![Laravel](https://camo.githubusercontent.com/b38aa2ff655206bfa9f97c1aeced06f25bb3e31fb085fa974c79934c25469f41/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125324631322d4646324432302e737667)](https://laravel.com/)

**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
------------

[](#installation)

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

Quick start
-----------

[](#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
-----

[](#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
-------

[](#testing)

```
composer install && composer test
```

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9d7c092a109fe780c7efd87ce4142eae2c0cec0f92fd1e87e769bec5661953b?d=identicon)[mohamedhekal](/maintainers/mohamedhekal)

---

Top Contributors

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

---

Tags

concurrencydistributed-lockslaravellaravel-packagephpredisphpconcurrencylaravellaravel-packageredismutexlockingjobsdistributed lockscache-lock

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mohamedhekal-lockguard/health.svg)

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

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

6093.4M9](/packages/propaganistas-laravel-disposable-email)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21617.2k](/packages/iazaran-smart-cache)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

24795.1k](/packages/harris21-laravel-fuse)[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.1k6.4M360](/packages/laravel-ai)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k17.6M165](/packages/laravel-pulse)

PHPackages © 2026

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