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

Testbench Laravel Package

orchestra/testbench

Orchestra Testbench is the de-facto Laravel testing helper for package development. It boots a lightweight Laravel app for your package’s tests, making it easy to run PHPUnit/Pest suites with proper service providers, config, and environment setup.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. Buy: Buy – Accelerates Laravel package development by eliminating the need to build custom testing infrastructure from scratch. Reduces technical debt and speeds up iteration.
  • Roadmap Priorities:
    • Package Reusability: Justify investment in reusable Laravel packages by ensuring robust, maintainable test coverage.
    • Developer Experience (DX): Improve onboarding for contributors by providing standardized testing tools (e.g., fixtures, mocking, parallel test support).
    • Quality Gates: Enforce test coverage thresholds for package releases (e.g., 90%+ for core features).
  • Use Cases:
    • Internal Packages: Standardize testing for proprietary Laravel packages (e.g., auth, reporting, or domain-specific modules).
    • Open-Source Contributions: Maintain high-quality tests for packages published to Packagist, reducing maintainer burden.
    • Legacy Migration: Modernize older Laravel packages (v8+) with updated testing practices (e.g., PHPUnit 13, PestPHP support).
    • CI/CD Optimization: Reduce flaky tests via Testbench’s state-flushing utilities (e.g., flushState() for JsonResource, Validator).
    • Multi-Environment Testing: Simulate different Laravel versions (e.g., v11–v13) or PHPUnit configurations without manual setup.

When to Consider This Package

Adopt Testbench if:

  • Your team builds Laravel packages (not full applications) and needs isolated, repeatable tests.
  • You require mocking Laravel services (e.g., Auth, Cache, Queue) without booting a full app.
  • Your roadmap includes parallel test execution (supported via WithFixtures trait).
  • You need fixture management (e.g., database seeding, API responses) for consistent test environments.
  • Your package targets Laravel 11+ (or 10+ with legacy support) and uses PHPUnit 12/13 or PestPHP.
  • You want to avoid flaky tests caused by global state (e.g., Str::macro(), Model eager-loading).

Look elsewhere if:

  • You’re building a full Laravel application (use Laravel’s built-in testing tools or PestPHP directly).
  • Your package is framework-agnostic (Testbench is Laravel-specific).
  • You need advanced browser testing (use Laravel Dusk or Playwright instead).
  • Your team lacks PHP/Laravel expertise to integrate testing tools (requires understanding of service providers, mockery, and Laravel’s container).
  • You’re on Laravel <10 or PHP <8.1 (Testbench drops support for older versions).

How to Pitch It (Stakeholders)

For Executives: *"Testbench is the industry-standard tool for testing Laravel packages, used by over 2,000+ open-source projects. By adopting it, we’ll:

  • Reduce development time by 30–50% for package testing (no reinventing the wheel).
  • Improve package quality with standardized tests, making them more attractive for adoption (internal/external).
  • Cut CI costs by enabling parallel tests and reducing flaky test failures.
  • Future-proof our tech stack with support for Laravel 13+, PHPUnit 13, and modern testing practices. Investment: Minimal (open-source, MIT-licensed). ROI: Faster releases, fewer bugs, and easier maintenance."*

For Engineering Teams: *"Testbench gives us:

  • Bootstrapped Laravel environments for packages without a full app (e.g., test a PaymentGateway package in isolation).
  • Mocking superpowers: Replace Auth, Cache, or Queue with fakes in seconds.
  • Fixtures & seeding: Spin up test databases or API responses with YAML/JSON files.
  • Parallel test support: Run tests faster in CI (critical for large test suites).
  • State management: Automatically reset global Laravel state (e.g., Str::macro(), Model caches) between tests. Example: Testing our Notification package? Testbench lets us mock the Mailer and Queue services, verify notifications are dispatched, and reset state—all without a real app. Tradeoff: A slight learning curve for Laravel’s service container, but the payoff is massive for package maintainability."*

For Developers: *"If you’re working on a Laravel package, Testbench is your secret weapon:

  • No more php artisan serve: Test your package’s logic without spinning up a full Laravel app.
  • Mock anything: Need to fake Auth::user()? Done. Test a Command without hitting the filesystem? Done.
  • Fixtures made easy: Define test data in YAML and load it with WithFixtures.
  • PHPUnit + PestPHP: Works with both, so you’re not locked into one. Pro tip: Use flushState() to avoid ‘test pollution’ from global Laravel state (e.g., Str::macro() or Validator rules). Start here: Official Docs + the create-testbench skeleton generator."*
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai