publicplan/parallel-bridge
Parallel Bridge integrates Laravel with parallel execution, making it simple to run isolated PHP tasks concurrently. It keeps Laravel's container and services available inside workers, so you can offload expensive work, process jobs in parallel, and improve performance without custom plumbing.
composer require publicplan/parallel-bridge. The package follows PSR-4 autoloading only — no bundle registration is required unless the README for the tagged version says otherwise. Check composer.json first to confirm what runtime it bridges (typically amphp/parallel, spatie/fork, or ext-parallel) and whether that peer dependency is already installed.README.md → src/ (the public service/interface names) → tests/ (the tests are the only reliable documentation for a 3-star package). Note that with so few dependents, examples are sparse — treat the test suite as canonical usage.config/services.yaml (autowiring should pick it up if the package registers its services). Verify with bin/console debug:container | grep -i parallel.A minimal smoke test in a console command:
foreach ($tasks as $task) {
$executor->add($task); // enqueue
}
$results = $executor->wait(); // or ->run()
If that returns the same array shape you put in, you're wired up correctly.
Symfony\Component\Console\Command\Command and chunk input into groups sized to min(cpu_count, n). This is the most common day-to-day use — offline imports, syncs, report generation.ParallelRunner service rather than injecting the raw bridge everywhere. This isolates the low-level API and makes it swappable when (not if) you migrate off a 3-star dependency.messenger:consume workers instead of forking inside a single process. The bridge is best for short-lived, in-process parallelism; Messenger is better for durable pipelines.config/packages/parallel_bridge.yaml (or your own bundle config) so ops can tune without code changes.$this, Symfony services, or Doctrine entities will fail or silently lose state. Pass plain data (arrays, scalars, DTOs with #[Serializable]-style shapes).amphp/parallel, spatie/fork, etc. Pin that peer version explicitly in your composer.json; bridge releases rarely constrain it tightly enough.echo/dump calls may interleave or vanish. Log to files (Monolog channels per worker) or return structured results and print in the parent. Xdebug inside forked workers is often broken — disable it in worker contexts.vendor/autoload.php is loaded in the child. Some bridges do this; some don't. Test under APP_ENV=prod before trusting it.composer remove is a one-file change. Watch the repo for the last-pushed date — if it's stale, plan to migrate.ParallelExecutorInterface or similar in src/; that (not the concrete class) is what you should type-hint in your own services so you can plug in a fake or a replacement later.How can I help you explore Laravel packages today?