veewee/composer-run-parallel
Run Composer scripts in parallel to speed up builds. composer-run-parallel executes multiple commands concurrently, with clear output and proper exit codes—great for CI pipelines, monorepos, and large projects where sequential scripts are too slow.
Add veewee/composer-run-parallel as a dev dependency:
composer require --dev veewee/composer-run-parallel
That’s it—no extra setup needed. The package installs a single command: composer run-parallel, which replaces composer run in scripts where concurrency is desired.
First use case: Define a multi-step workflow (e.g., lint, test, build) that can run in parallel. In composer.json, extend your scripts:
{
"scripts": {
"lint": ["php-cs-fixer fix --dry-run", "phpstan analyse"],
"test": ["phpunit", "pest"],
"build": ["composer lint", "composer test"],
"ci": "composer run-parallel lint test build"
}
}
Then run:
composer run-parallel ci
All three top-level tasks (lint, test, build) execute concurrently. Each group (lint’s two commands) runs sequentially within its task, but tasks themselves run in parallel.
lint, test, typecheck, build) as top-level Composer scripts and invoke them in parallel via run-parallel.composer ci (sequential) for local dev, and use composer run-parallel ci-fast for CI runners.{
"scripts": {
"format": "php-cs-fixer fix",
"analyze": ["phpstan", "psalm"],
"unit": "phpunit --group unit",
"integration": "phpunit --group integration",
"pre-commit": "composer format && composer run-parallel analyze unit integration"
}
}
phpscs-style dispatching:
"ci": [
"cd services/auth && composer run-parallel lint test",
"cd services/api && composer run-parallel lint test"
]
--debug to see real-time execution.|| true only for optional tasks (e.g., "lint:optional": "phpstan --allow-non-zero || true"), but avoid it in critical pipelines.var/cache/), ensure proper locking or avoid parallelizing those steps—this tool doesn’t coordinate I/O.proc_open() and POSIX-style shell; works via PowerShell/Cygwin but avoid && inside task names. Prefer arrays for multi-command scripts:
"lint": ["phpcs", "php-cs-fixer"]
COMPOSER_RUN_PARALLEL_DEBUG=1 to get timing breakdown per task.composer run—you must explicitly use run-parallel. This preserves backward compatibility but requires updating scripts maps. Consider using a "lint-parallel": "composer run-parallel lint" alias for gradual adoption.How can I help you explore Laravel packages today?