null
Find a file
Brian Faust 528d2ed949
wip
Signed-off-by: Brian Faust <brian@cline.sh>
2025-12-11 15:10:56 +02:00
config first commit 2025-11-30 05:44:50 +02:00
cookbook wip 2025-12-11 15:10:56 +02:00
database/migrations first commit 2025-11-30 05:44:50 +02:00
docker/php first commit 2025-11-30 05:44:50 +02:00
src wip 2025-12-11 15:10:56 +02:00
tests wip 2025-12-11 15:10:56 +02:00
.gitignore first commit 2025-11-30 05:44:50 +02:00
CHANGELOG.md first commit 2025-11-30 05:44:50 +02:00
CODE_OF_CONDUCT.md first commit 2025-11-30 05:44:50 +02:00
composer.json wip 2025-12-11 15:10:56 +02:00
CONTRIBUTING.md first commit 2025-11-30 05:44:50 +02:00
docker-compose.yml first commit 2025-11-30 05:44:50 +02:00
ecs.php wip 2025-12-11 15:10:56 +02:00
LICENSE.md first commit 2025-11-30 05:44:50 +02:00
Makefile wip 2025-12-11 15:10:56 +02:00
phpstan.neon.dist first commit 2025-11-30 05:44:50 +02:00
phpunit.xml.dist first commit 2025-11-30 05:44:50 +02:00
README.md first commit 2025-11-30 05:44:50 +02:00
rector.php wip 2025-12-11 15:10:56 +02:00
SECURITY.md first commit 2025-11-30 05:44:50 +02:00
testbench.yaml first commit 2025-11-30 05:44:50 +02:00
TODO.md first commit 2025-11-30 05:44:50 +02:00

GitHub Workflow Status Latest Version on Packagist Software License Total Downloads


Chaperone

A powerful Laravel package that supervises and guards long-running queue jobs with health monitoring, circuit breaker protection, and intelligent recovery mechanisms. Ensures your background jobs complete successfully or recover gracefully from failures.

Requirements

Requires PHP 8.4+ and Laravel 11+

Installation

composer require cline/chaperone

Publish configuration and migrations:

php artisan vendor:publish --tag=chaperone-config
php artisan vendor:publish --tag=chaperone-migrations
php artisan migrate

Quick Start

Add the Supervised trait to any queue job and call heartbeat() to signal it's alive:

use Cline\Chaperone\Concerns\Supervised;
use Illuminate\Contracts\Queue\ShouldQueue;

class ImportUsers implements ShouldQueue
{
    use Supervised;

    public function handle(): void
    {
        $users = User::cursor();
        $total = User::count();

        foreach ($users as $index => $user) {
            $this->processUser($user);

            // Signal we're alive
            $this->heartbeat(['current_user' => $user->email]);

            // Report progress
            $this->reportProgress($index + 1, $total);
        }
    }
}

Monitor supervised jobs:

php artisan chaperone:monitor

Documentation

Key Features

  • Health Monitoring - Track heartbeats and detect stuck/zombie jobs
  • Circuit Breakers - Protect external services from cascading failures
  • Resource Limits - Enforce memory, CPU, and disk usage constraints
  • Progress Tracking - Monitor job completion with real-time progress
  • Lifecycle Hooks - Callbacks for stuck, timeout, and resource violations
  • Dead Letter Queue - Automatic handling of permanently failed jobs
  • Observability - Integration with Laravel Pulse, Telescope, and Horizon
  • Artisan Commands - Real-time monitoring dashboard and management tools
  • Event System - Comprehensive events for custom monitoring and alerting

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.

Credits

License

The MIT License. Please see License File for more information.