yuna/supervisor

Maintainers

Details

codeberg.org/yuna/supervisor

Installs: 13

Dependents: 1

Suggesters: 0

Security: 0

pkg:composer/yuna/supervisor

1.2.5 2025-10-23 17:10 UTC

This package is not auto-updated.

Last update: 2025-10-23 17:11:19 UTC


README

Semi-simple process supervisor written in PHP - possible thanks to amphp.

Requirements:

  • PCNTL
  • PHP 8.2

Features:

  • health checks
  • dependencies
  • retries

Installation

composer require yuna/supervisor:^1

Example

$supervisor = new Yuna\Supervisor\Supervisor(
    services: [
        ServiceBuilder::create()
            ->name('nginx')
            ->command("nginx -g 'daemon off;'")
            ->dependencies([
                'php-fpm' => ServiceState::Healthy
            ])
            ->build(),
        ServiceBuilder::create()
            ->name('php-fpm')
            ->command("php-fpm")
            ->healthcheck(fn() => HealthChecker::socket('localhost', 9000))
            ->build()
    ],
    logger: new Logger(debug: false) // optional - must implement Psr\Log\LoggerInterface
);

exit($supervisor->run());