jenner/simple_fork
SimpleFork is a PHP PCNTL-based multi-process framework with Java-like Thread/Runnable APIs. It provides process pools, automatic zombie recovery, signal handling, and IPC options like shared memory, SysV queues/semaphores, file locks, and Redis queues/cache.
FixedPool, ParallelPool, and SinglePool, enabling dynamic concurrency control.pcntl (mandatory) and optional extensions (sysv*, redis). Laravel’s php.ini can be pre-configured for pcntl in worker environments.SimpleForkServiceProvider with config for pool sizes, IPC methods).SimpleFork pools while keeping critical jobs in Redis/SQS).php artisan fork:reload to trigger FixedPool::reload()).pcntl_signal_dispatch, fork()) for PHP 8.x.SIGTERM) may conflict with Laravel’s process managers (e.g., supervisor). Mitigation:
getmypid()) and statuses (isStarted(), isStopped()).monolog handlers per process).Illuminate\Queue\Worker for specific job types?shouldRequeue()) in a process context?ulimit (e.g., max processes per user) in shared hosting?fork:start, fork:stop).SimpleFork pools as singletons with configurable defaults.ProcessPoolStarted, ProcessFailed).SimpleFork pools for parallelizable tasks, keep critical jobs in Redis/SQS.SimpleForkJob class extending Laravel’s Job interface.php artisan fork:worker) to avoid conflicts with Laravel’s FPM..env variables to configure pool sizes, IPC methods, and timeouts.FixedPool.// app/Providers/SimpleForkServiceProvider.php
public function register()
{
$this->app->singleton('csv.import.pool', function () {
return new \Jenner\SimpleFork\FixedPool(4);
});
}
pcntl enabled in php.ini:
extension=pcntl
SimpleForkJob class:
class ParallelImageResizeJob implements \Jenner\SimpleFork\Runnable {
public function run() {
// Resize logic here
}
}
php artisan fork:execute ParallelImageResizeJob --pool-size=8
// app/Console/Kernel.php
protected function schedule(Schedule $schedule) {
$schedule->job(new ParallelImageResizeJob)
->onSimpleForkPool('image.resize', 4);
}
SimpleForkQueue class to route jobs to pools./api/process-pools).pcntl (enable in php.ini for worker environments).sysv*, redis (fallback to Redis for cross-process comms).pcntl and SysV IPC).pcntl in PHP and worker environments..env.SimpleFork as a Laravel service provider.SimpleForkJob interface for reusable workers.pcntl or IPC extension updates.FixedPool sizes).getmypid() and process statuses (isStarted()) for debugging.monolog with process IDs in log context.htop/ps for monitoring worker processes.How can I help you explore Laravel packages today?