Download the PHP package race-lab/laravel-race-lab without Composer
On this page you can find all versions of the php package race-lab/laravel-race-lab. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download race-lab/laravel-race-lab
More information about race-lab/laravel-race-lab
Files in race-lab/laravel-race-lab
Package laravel-race-lab
Short Description Deterministic concurrency and race-condition testing for Laravel.
License MIT
Informations about the package laravel-race-lab
Laravel Race Lab
Deterministic concurrency and race-condition testing for Laravel.
Instead of running a test hundreds of times and hoping the scheduler exposes a race, Race Lab launches fresh Laravel PHP worker processes against the same database and pauses them at deterministic checkpoints.
Install
Until the first Packagist release, install directly from this GitHub repository:
After the package is published on Packagist, installation becomes:
Supported target: PHP 8.2+, Laravel 11/12/13. MySQL/MariaDB and PostgreSQL are first-class targets. SQLite has different locking semantics and should not be used to prove production concurrency correctness.
Lost update
Both workers reach the SELECT and block. The barrier auto-releases only after both arrived.
Double approval
Capture scalar IDs in worker closures and resolve Models/services inside the worker. Each worker boots a fresh Laravel container and fresh PDO connection.
Controlled interleaving
Use a non-auto-releasing gate and a parent schedule when exact order matters:
For interactive orchestration:
Manual checkpoints
Transaction checkpoints
Available phases: beforeBegin, begin, committing, commit, rollback.
Query matching
For complex/raw/vendor-specific SQL:
The built-in table matcher intentionally stays small rather than pretending to be a full SQL parser.
Redis coordinator
File coordination is the default and requires no service. For shared/containerized CI:
Redis keys use TTLs so interrupted runs do not leave permanent coordination state.
Assertions
Race Lab deliberately does not provide a generic assertNoLostUpdate(): only the application knows its business invariant.
Trace and replay
Failed runs are preserved under:
Render a timeline:
Replay a persisted plan:
Successful traces are deleted by default; set RACE_LAB_PERSIST_SUCCESS=true or call ->persistTrace().
Critical database rule
Do not wrap a race test in a parent DatabaseTransactions / transactional RefreshDatabase transaction. Workers use independent PDO connections, so uncommitted fixtures may be invisible and parent locks can create artificial behavior. Race Lab detects active parent transactions by default and refuses to start.
Prepare and commit fixtures, run the race, assert, then clean up.
Production guard
Race Lab refuses to execute in production by default. It is intended as a require-dev dependency. Enabling RACE_LAB_ALLOW_PRODUCTION=true is intentionally explicit and strongly discouraged.
Commands
race-lab:worker is internal and is spawned by the runtime.
Architecture
See docs/ARCHITECTURE.md.
All versions of laravel-race-lab with dependencies
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
laravel/serializable-closure Version ^2.0
symfony/process Version ^6.4|^7.0|^8.0