Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Process Control Bundle

Process Control Bundle Laravel Package

aboutcoders/process-control-bundle

Symfony bundle providing process control via a container service (abc.process_control.controller). Default PCNTL implementation listens for SIGTERM so long-running jobs can detect when to exit. Service registration can be disabled via configuration.

View on GitHub
Deep Wiki
Context7

A symfony bundle that provides process control

Frequently asked questions about Process Control Bundle
Can I use this bundle directly in Laravel, or is it only for Symfony?
This bundle is designed for Symfony but can be adapted for Laravel by using the Symfony Bridge (symfony/service-container) to emulate dependency injection. You’ll need to manually register the `abc.process_control.controller` service in Laravel’s `AppServiceProvider` or via a facade. The core functionality (SIGTERM handling) remains the same.
How do I install this bundle in a Laravel project?
Add the package via Composer (`composer require aboutcoders/process-control-bundle`), then manually register the service in Laravel’s container. Since it’s Symfony-focused, you’ll need to replicate its DI setup using `singleton()` in `AppServiceProvider`. No kernel registration is required for Laravel.
Does this bundle work on Windows, or is it Linux/macOS only?
The bundle relies on PHP’s `pcntl` extension, which is Linux/macOS-only. For Windows, you’ll need a fallback—like polling a shutdown flag via HTTP or using Laravel’s `registerShutdownFunction`. Consider Docker or VMs for cross-platform compatibility if `pcntl` is critical.
How do I check for SIGTERM in a Laravel queue worker or long-running job?
Inject the `abc.process_control.controller` service into your worker or job class, then call `$controller->doExit()` in loops or before critical operations. If the method returns `true`, exit gracefully. Example: `if ($controller->doExit()) exit(0);` in your worker’s main loop.
What happens if the `pcntl` extension is disabled in my PHP environment?
The bundle will fail to initialize the PCNTL-based signal handler, and the `abc.process_control.controller` service may throw errors. Always check `extension_loaded('pcntl')` before using the bundle, or implement a fallback (e.g., HTTP-based shutdown flags) for environments where `pcntl` isn’t available.
Is this bundle compatible with Laravel 8/9/10, or only older versions?
The bundle targets Symfony 5+, which aligns with Laravel 8+ (due to Symfony Bridge compatibility). Laravel 9/10 should work, but test thoroughly, especially if using newer Symfony components. The `~1.0` version suggests early-stage stability, so monitor updates for breaking changes.
Can I disable the service registration if I don’t need process control?
Yes, the bundle supports disabling service registration via configuration. In Laravel, you’d set this in `config/abc_process_control.php` (adapted from Symfony’s YAML config). Example: `'register_controller' => false`. This skips PCNTL initialization entirely.
Are there alternatives to this bundle for Laravel process control?
For Laravel, consider native solutions like Laravel Queues with SIGTERM hooks, Supervisor for process management, or the Symfony Process Component (cross-platform but heavier). If you need lightweight SIGTERM handling, this bundle is a good fit, but for broader orchestration, Supervisor or Laravel Horizon may be better.
How do I integrate this with Laravel’s event system or Horizon?
Since this bundle doesn’t use Symfony’s event system, you’ll need to manually trigger events in Laravel when `doExit()` is called. For Horizon, you could extend the worker to listen for the controller’s shutdown signal and dispatch a Laravel event (e.g., `ProcessTerminating`). Combine it with Horizon’s built-in retry logic for robustness.
What’s the best way to test this bundle in a Laravel project?
Test in a Docker container with Linux to ensure `pcntl` works. Use Laravel’s `Artisan::call()` to simulate long-running commands, then send SIGTERM via `kill -15` in another terminal. Mock the controller in unit tests to verify `doExit()` behavior. For Windows, test your fallback mechanism (e.g., HTTP shutdown endpoints).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware