PHPackages                             zidbih/laravel-deadlock - 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. zidbih/laravel-deadlock

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

zidbih/laravel-deadlock
=======================

Make temporary Laravel workarounds expire and fail CI when ignored.

v0.4.0(2mo ago)961.8k—0%2MITPHPPHP ^8.2CI passing

Since Dec 30Pushed 1mo agoCompare

[ Source](https://github.com/medmahmoudhdaya/laravel-deadlock)[ Packagist](https://packagist.org/packages/zidbih/laravel-deadlock)[ RSS](/packages/zidbih-laravel-deadlock/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (14)Versions (11)Used By (0)

Laravel Deadlock
================

[](#laravel-deadlock)

[![Packagist Version](https://camo.githubusercontent.com/6cf14a2951b45c45dfc7b1cc270190479f23de84eacd560df1be18e35da43bb1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a69646269682f6c61726176656c2d646561646c6f636b)](https://camo.githubusercontent.com/6cf14a2951b45c45dfc7b1cc270190479f23de84eacd560df1be18e35da43bb1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a69646269682f6c61726176656c2d646561646c6f636b)[![Packagist Downloads](https://camo.githubusercontent.com/ca1b1bd58ce19558e5823fd794c3758f94f7c7967a49c242268d3c24a6de2627/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a69646269682f6c61726176656c2d646561646c6f636b)](https://camo.githubusercontent.com/ca1b1bd58ce19558e5823fd794c3758f94f7c7967a49c242268d3c24a6de2627/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a69646269682f6c61726176656c2d646561646c6f636b)[![Packagist License](https://camo.githubusercontent.com/95603b28f726016c869b93e7cf00b999b1082c32ed5671745a3a65e16e1d8610/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a69646269682f6c61726176656c2d646561646c6f636b)](https://camo.githubusercontent.com/95603b28f726016c869b93e7cf00b999b1082c32ed5671745a3a65e16e1d8610/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a69646269682f6c61726176656c2d646561646c6f636b)[![codecov](https://camo.githubusercontent.com/75ca6a4a83f774841a8459ea368eba9666972aa974439ddcd5c10c748fdfee44/68747470733a2f2f636f6465636f762e696f2f67682f6d65646d61686d6f756468646179612f6c61726176656c2d646561646c6f636b2f67726170682f62616467652e737667)](https://codecov.io/gh/medmahmoudhdaya/laravel-deadlock)

Have you ever shipped a temporary workaround and never came back to it?
Laravel Deadlock makes those workarounds explicit and time-boxed.

Annotate classes or methods with an expiration date, then enforce them in local development and CI without affecting production.

**What it does**

- Scans the codebase for `#[Workaround]` attributes
- Lists workarounds and their status
- Fails CI when a workaround has expired
- Blocks local execution of expired code
- Never enforces in production

---

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

[](#installation)

```
composer require zidbih/laravel-deadlock
```

### Requirements

[](#requirements)

- PHP: **8.2+**
- Laravel: **10, 11, 12, 13**

### Compatibility

[](#compatibility)

- Laravel **10, 11, 12**: PHP **8.2+**
- Laravel **13**: PHP **8.3+**

---

Quick Start
-----------

[](#quick-start)

Annotate a temporary workaround with a clear description and expiration date.

```
use Zidbih\Deadlock\Attributes\Workaround;

#[Workaround(
    description: 'Temporary bypass for legacy payment gateway',
    expires: '2025-03-01'
)]
class PaymentService
{
    // ...
}
```

**Supported targets**
`#[Workaround]` can be applied to **classes and methods**.
Workarounds inside functions or other scopes are ignored.

### What happens when it expires?

[](#what-happens-when-it-expires)

- **Local Development**: Execution is blocked with an exception
- **CI/CD**: Pipelines fail when running the check command
- **Production**: No effect

---

Enforcement Modes
-----------------

[](#enforcement-modes)

### Controllers (Automatic)

[](#controllers-automatic)

Controllers are discovered automatically and enforced at runtime.
Add the attribute; no additional calls are required.

```
namespace App\Http\Controllers;

use Zidbih\Deadlock\Attributes\Workaround;

#[Workaround(description: 'Legacy controller awaiting refactor', expires: '2025-06-01')]
final class UserController extends Controller
{
    #[Workaround(description: 'Temporary validation bypass', expires: '2025-02-01')]
    public function store()
    {
        // ...
    }
}
```

### Services, Jobs, Commands (Explicit)

[](#services-jobs-commands-explicit)

For non-controller classes, enforcement is explicit by design to avoid hidden runtime behavior.

#### Class-Level Enforcement

[](#class-level-enforcement)

```
namespace App\Services;

use Zidbih\Deadlock\Attributes\Workaround;
use Zidbih\Deadlock\Support\DeadlockGuard;

#[Workaround(description: 'Temporary legacy pricing service', expires: '2025-01-01')]
final class PricingService
{
    public function __construct()
    {
        DeadlockGuard::check($this);
    }
}
```

#### Method-Level Enforcement

[](#method-level-enforcement)

```
namespace App\Services;

use Zidbih\Deadlock\Attributes\Workaround;
use Zidbih\Deadlock\Support\DeadlockGuard;

final class PricingService
{
    #[Workaround(description: 'Temporary calculation logic', expires: '2025-02-01')]
    public function calculate()
    {
        DeadlockGuard::check($this, __FUNCTION__);

        return 42;
    }
}
```

---

Artisan Commands
----------------

[](#artisan-commands)

### List Workarounds

[](#list-workarounds)

```
php artisan deadlock:list
```

Example output:

[![List command output](docs/images/list-command-output.png)](docs/images/list-command-output.png)

### Filters

[](#filters)

Show only expired workarounds:

```
php artisan deadlock:list --expired
```

Show only active workarounds:

```
php artisan deadlock:list --active
```

Show workarounds expiring in **7 days or less**:

```
php artisan deadlock:list --critical
```

### Stats

[](#stats)

The list command now includes a summary line by default, showing totals at a glance.

---

CI/CD Enforcement
-----------------

[](#cicd-enforcement)

Run the check command in your pipeline:

```
php artisan deadlock:check
```

If an expired workaround is found, the command exits with **code 1**.

For machine-readable output, use JSON mode:

```
php artisan deadlock:check --json
```

Example JSON output:

```
{
  "success": false,
  "expired_count": 1,
  "expired": [
    {
      "description": "Temporary payment gateway workaround",
      "expires": "2025-02-10",
      "location": "PaymentService::process",
      "file": "/app/Services/PaymentService.php",
      "line": 18,
      "class": "PaymentService",
      "method": "process"
    }
  ]
}
```

Example failure output:

```
Expired workarounds detected:

- Temporary payment gateway workaround | expires: 2025-02-10 | PaymentService::process
- Legacy admin controller | expires: 2025-01-31 | AdminController

```

CI example:

```
- name: Deadlock check
  run: php artisan deadlock:check
```

---

Runtime Enforcement (Local Only)
--------------------------------

[](#runtime-enforcement-local-only)

When an expired workaround is accessed locally, a `WorkaroundExpiredException` is thrown with:

- Description
- Expiration date
- Exact code location

Example exception output:

[![Expired workaround exception](docs/images/workaround-exception.png)](docs/images/workaround-exception.png)

---

Production Safety
-----------------

[](#production-safety)

Laravel Deadlock never enforces debt in production.

- Runtime exceptions only occur in **local** environments
- CI blocks merges before debt reaches production
- Live users are never affected

---

Testing
-------

[](#testing)

The test suite uses **PHPUnit** and **Orchestra Testbench** for compatibility across supported Laravel versions.

---

License
-------

[](#license)

[MIT](LICENSE)

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md)

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance89

Actively maintained with recent releases

Popularity36

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Recently: every ~16 days

Total

10

Last Release

62d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laraveltodoworkaroundmaintainabilitytechnical debttemporary fixci enforcementcode expiration

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/zidbih-laravel-deadlock/health.svg)

```
[![Health](https://phpackages.com/badges/zidbih-laravel-deadlock/health.svg)](https://phpackages.com/packages/zidbih-laravel-deadlock)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)

PHPackages © 2026

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