- What is recca0120/async-testing used for in a Laravel project?
- It is a Laravel/PHP testing helper aimed at asynchronous code, offering utilities to write and run tests around async flows so non-blocking behavior stays readable and reliable. It is a development-time dependency that sits alongside PHPUnit rather than inside your application runtime, so it never ships to production. Note that the package markets itself under both an async and a parallel framing, which are not the same execution model, so confirm which one you actually get before committing.
- How do I install recca0120/async-testing?
- Install it with Composer as a dev dependency using composer require --dev recca0120/async-testing. Optionally publish its configuration file if the package ships one, and wire it in through a dedicated composer script or a CI step. Mechanically the install is trivial; the real work is making sure your test suite is isolated enough for a parallel or async harness.
- Does this package run asynchronous code or parallel test processes?
- That is the key ambiguity to resolve before adopting it. Asynchronous testing implies an event loop, promises, or coroutines, whereas parallel testing means process-level worker fan-out in the ParaTest style. The package presents both framings, and the two models impose very different constraints on test isolation, required extensions, and CI topology. Run a small spike to see which model you actually get.
- How does it compare to Laravel's built-in php artisan test --parallel?
- It substantially overlaps with Laravel's first-party parallel testing, which is ParaTest-backed and includes ParallelTesting hooks for database and cache isolation. Treat the package as an alternative ergonomics layer or experiment rather than an assumed upgrade. The recommended approach is to run both, compare wall-clock time and flake rate, and let the numbers decide. Keep artisan test as the source of truth for merge gating in the meantime.
- Which Laravel and PHP versions does recca0120/async-testing support?
- The maintainer has a narrow compatibility contract rather than a broad one, and the last release was in May 2024, so re-validation against each new Laravel major is required. Check the composer.json constraints for hard requirements on PHP, PHPUnit, and the framework before adopting. There is no widely published, extensively tested compatibility matrix, so verify support for your exact stack with a trial run.
- Does it require PHP extensions like Swoole, or specific drivers?
- The available information does not specify required extensions or drivers, so check the package's composer.json and README before planning adoption. If it delivers true asynchronous execution it likely depends on event-loop primitives such as ReactPHP, Amp, or Swoole, which have their own runtime requirements. Process-level parallelism, by contrast, typically needs no extra extensions beyond what ParaTest already requires. Confirm this early because it directly affects your CI image.
- How does it handle database isolation, migrations, and seeding across concurrent workers?
- The provided evaluation does not document the package's isolation strategy, so treat this as an open question to verify against its source and README. Laravel's own ParallelTesting hooks handle database and cache isolation for the built-in runner, and you should confirm whether this package reuses them or rolls its own. Test explicitly for migrations, transactions, and seeding behavior under multiple workers before trusting the results.
- Is it safe to keep as a dev dependency, and does it affect production?
- Yes, production risk is low because it is a development-only dependency that does not touch production request paths or ship in the deployable artifact. Install it under require-dev so it stays out of your production dependency graph. The blast radius of a problem is bounded by simply removing the package. The material risks are test-infrastructure risk and sustainability risk, not runtime risk.
- How should I wire it into CI without destabilizing my build?
- Do not replace your default test command. Add the package behind a separate composer script such as composer test:async and run it as a distinct, non-blocking CI job. Keep php artisan test as the merge gate until the new job has shown stable green results across a meaningful number of runs. Compare wall-clock time and flake rate against the built-in --parallel flag before promoting it.
- Will adopting a parallel or async test runner break my existing suite?
- It can, because a parallel or async harness magnifies any pre-existing shared-state coupling in your tests. Watch for fixed database fixtures, shared Redis keys, static caches, hardcoded ports, and filesystem writes outside storage/framework. Suites with strong isolation are cheap to adopt, while legacy fixture coupling turns a tooling decision into a refactor project. Assess integration per test suite rather than per repository.