Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Fastest Laravel Package

liuggio/fastest

Run tests in parallel with a simple CLI wrapper. Fastest executes any command (PHPUnit, Behat, etc.) across available CPU cores, randomizes test order, supports piping test lists or phpunit.xml, adds verbosity flags, and helps functional tests use one DB per process.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Parallel Test Execution: Aligns perfectly with Laravel’s PHPUnit-based testing ecosystem, addressing a critical bottleneck in functional/integration test suites (commonly 30+ minutes for large codebases).
  • Database Isolation: Native support for per-process database isolation (via ENV_TEST_CHANNEL_READABLE) is a game-changer for Laravel apps using Doctrine/Symfony, eliminating race conditions in functional tests.
  • Tool-Agnostic Design: Works with any CLI tool (PHPUnit, Behat, custom scripts), but Laravel-specific integrations (Doctrine adapters, Symfony kernel hooks) make it a high-leverage choice for Laravel projects.
  • Randomization: Default test randomization mitigates flaky test dependencies, a known issue in Laravel’s test suites.

Integration Feasibility

  • Zero Laravel-Specific Dependencies: Pure PHP implementation with no Laravel core coupling, reducing risk of version conflicts.
  • Composer Integration: Standard require-dev installation with no global state modifications (unlike paratest).
  • Symfony Kernel Hook: Minimal setup required (FastestEnvironment::setFromRequest() in app_dev.php) for browser-based tests (e.g., Dusk, Pest with browser drivers).
  • CI/CD Friendly: Supports parallel execution in CI (GitHub Actions, CircleCI) with no infrastructure changes.

Technical Risk

Risk Area Mitigation Strategy
Database Connection Leaks Use Doctrine adapters to ensure per-process DB cleanup; monitor ENV_TEST_CHANNEL_READABLE usage.
Test Isolation Failures Validate randomization with --preserve-order for debugging; use -b for pre-test setup.
Browser Test Conflicts Implement FastestEnvironment::setFromRequest() early in the request lifecycle (e.g., middleware).
Coverage Merging Require phpcov/phpunit-merger for accurate coverage reports; document workflow.
Legacy PHPUnit Test with Laravel’s default PHPUnit version (v9+) to avoid deprecated API issues.

Key Questions

  1. Test Suite Composition:
    • Are functional tests database-dependent? If yes, fastest’s per-process DB isolation is critical.
    • Do tests use shared state (e.g., caches, static variables)? If so, randomization may need --preserve-order.
  2. CI/CD Constraints:
    • Does the CI environment have sufficient CPU cores for parallelization? (Default: nproc.)
    • Are there resource limits (e.g., memory per process) that could cause test failures?
  3. Tooling Stack:
    • Is Behat used alongside PHPUnit? If yes, the Behat extension simplifies parallel scenario execution.
    • Are custom test runners used? fastest supports any CLI command, but Laravel-specific tooling (e.g., Pest) may need wrapper scripts.
  4. Monitoring:
    • How will test failures be attributed to specific processes? (Use -vvv for verbose output.)
    • Is there a dashboard (e.g., GitHub Actions annotations) to visualize parallel test results?

Integration Approach

Stack Fit

  • Primary Use Case: Laravel functional/integration tests (e.g., Feature tests, API tests with database interactions).
  • Secondary Use Case: Behat scenarios (via the Behat extension) or custom CLI scripts (e.g., Artisan commands).
  • Anti-Patterns:
    • Avoid for unit tests (overhead of process creation outweighs benefits).
    • Not ideal for tests with heavy shared memory (e.g., Redis caches without isolation).

Migration Path

Phase Action Laravel-Specific Notes
Assessment Run a subset of tests in parallel to validate isolation (e.g., `find tests/Feature -name "*Test.php" fastest "phpunit {}"`).
Database Setup Configure Doctrine adapters in config/database.php (see SQLite/Doctrine examples). For SQLite, replace __DBNAME__ in the path.
CI/CD Pilot Test in a non-production CI environment with fastest -x phpunit.xml -p 4 "phpunit". Monitor resource usage (e.g., nproc --all for core count).
Full Rollout Update phpunit.xml to include parallel execution in CI workflows. Example: phpunit --testdox-html=report.htmlfastest -x phpunit.xml "phpunit --testdox-html=report_{n}.html".

Compatibility

Component Compatibility Notes
PHPUnit Tested with PHPUnit v9+ (Laravel’s default). No breaking changes expected.
Doctrine Adapters for DBAL and MongoDB; no ORM-specific changes required.
Symfony Kernel Requires FastestEnvironment::setFromRequest() in app_dev.php for browser tests.
Behat Extension supports --list-features/--list-scenarios for parallel scenario execution.
Pest Use wrapper scripts (e.g., fastest "pest {}"), but Pest’s built-in parallelism may conflict.
Dusk Critical: Set ENV_TEST_CHANNEL_READABLE via cookies/headers (see browser test section).

Sequencing

  1. Pre-Test Setup:
    • Configure Doctrine adapters (if using databases).
    • Add FastestEnvironment::setFromRequest() to app_dev.php (for browser tests).
    • Set up before commands (e.g., -b "php artisan migrate:fresh --env=testing_{p}") for test data.
  2. Test Execution:
    • Start with small batches (e.g., 2–4 processes) to validate stability.
    • Use -x phpunit.xml for structured test suites or find tests/ -name "*Test.php" for file-based.
  3. Post-Test:
    • Merge coverage with phpcov merge.
    • Analyze failures with -vvv to isolate process-specific issues.

Operational Impact

Maintenance

  • Pros:
    • No Laravel core modifications required.
    • MIT License: No legal/licensing concerns.
    • Active Development: Regular updates (last release in 2026).
  • Cons:
    • Database Cleanup: Requires discipline to reset per-process databases (e.g., --before commands).
    • Coverage Reports: Manual merging needed (document this in the team’s testing guide).
    • Debugging Complexity: Randomized tests may obscure deterministic failures (mitigate with --preserve-order).

Support

  • Troubleshooting:
    • Database Conflicts: Check ENV_TEST_CHANNEL_READABLE values in test logs.
    • Browser Tests: Verify FastestEnvironment::setFromRequest() is called early.
    • Performance: Use -p to limit processes if tests OOM (e.g., -p 2).
  • Documentation:
    • Internal Wiki: Document the fastest workflow, including:
      • Example commands for common test types (PHPUnit, Behat, Pest).
      • Debugging steps for flaky tests.
      • CI/CD configuration snippets.
    • Onboarding: Add a README.md section for new devs (e.g., "How to Run Tests in Parallel").

Scaling

  • Horizontal Scaling:
    • CI Parallelism: Run fastest in multiple CI jobs (e.g., split test suites by feature).
    • Local Development: Use -p $(nproc) for multi-core machines.
  • Vertical Scaling:
    • Memory Limits: Monitor per-process memory usage; adjust -p if tests OOM.
    • Database Load: Ensure test databases (e.g., MySQL) can handle concurrent connections.
  • Benchmarking:
    • Compare execution time with/without fastest (e.g., 30m → 7m in the package’s example).

Failure Modes

Failure Scenario Detection Method Mitigation Strategy
Database Connection Leaks Tests hang or timeout. Use --before to reset databases; monitor ENV_TEST_CHANNEL_READABLE.
Test Isolation Violations Flaky tests pass/fail randomly. Run with --preserve-order to debug; add sleep() between tests if needed.
Browser Test Conflicts Dusk/Behat tests fail with "wrong DB". Verify FastestEnvironment::setFromRequest() is called; check cookies/headers.
Resource Exhaustion
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle
dmstr/api-platform-utils-bundle
dmstr/api-configuration-bundle
chrisdev/ux-components
baks-dev/finances
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle