PHP code example of zidbih / laravel-deadlock

1. Go to this page and download the library: Download zidbih/laravel-deadlock library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zidbih / laravel-deadlock example snippets


use Zidbih\Deadlock\Attributes\Workaround;

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

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()
    {
        // ...
    }
}

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);
    }
}

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;
    }
}
bash
php artisan deadlock:list
bash
php artisan deadlock:list --expired
bash
php artisan deadlock:list --active
bash
php artisan deadlock:list --critical
bash
php artisan deadlock:check
bash
php artisan deadlock:check --fail-within=7
bash
php artisan deadlock:check --strict
bash
php artisan deadlock:check --json
bash
php artisan deadlock:doctor
bash
php artisan deadlock:extend --controller=TestController --days=7
php artisan deadlock:extend --controller=Admin\TestController --method=index --months=1
php artisan deadlock:extend --class=App\Services\PricingService --days=7
bash
php artisan deadlock:extend --class=App\Services\PricingService --months=1 --days=7
bash
php artisan deadlock:extend --class=App\Services\PricingService --date=2026-06-01
bash
php artisan deadlock:extend --class=App\Services\PricingService --days=7
bash
php artisan deadlock:extend --class=App\Services\PricingService --method=calculate --days=7
bash
php artisan deadlock:extend --controller=TestController --days=7
bash
php artisan deadlock:extend --controller=Admin\TestController --method=index --date=2026-06-01
bash
php artisan deadlock:check