toplan/task-balancer
Toplan Task Balancer is a Laravel package that helps distribute tasks and queue workloads evenly across workers, reducing bottlenecks and improving throughput. It integrates smoothly with Laravel and offers simple configuration for more reliable background job processing.
composer require toplan/task-balancer and pin it (^1.0) — the last tagged release is June 2017, so treat it as a legacy dependency. Run your test suite on your target PHP version immediately after installing; PHP 8.1+ compatibility is the first thing to verify.Task/Worker classes to see how data is handed to a worker.app/Console/Commands or a small service class; do not wire it into normal HTTP request handling.Illustrative shape (confirm names against the README):
$task = new Task($payload);
$task->worker('worker-a', fn ($t) => /* ... */);
$task->worker('worker-b', fn ($t) => /* ... */);
$task->driver('polling'); // round-robin-ish
(new Balancer())->addTask($task)->start();
TaskBalancerService that exposes your domain verbs (dispatchImageJob(), pickApiClient()) and hides the package API. Bind it as a singleton in a service provider only if it's stateless; otherwise resolve a fresh instance per job.weight=. Use them when upstreams are not equal — a higher-rate-limit API account gets a bigger weight. This is the pattern that maps most directly to the package's advertised "like nginx" behaviour.Context out of the box.try/catch, implement your own failover, and don't let a worker exception silently drop the task.max_execution_time and tie up an FPM worker. Keep this out of web controllers.dd() in your wrapper is the fastest path.vendor/, and pin the version in composer.json so a fork/rename doesn't break installs.How can I help you explore Laravel packages today?