- Is zenstruck/browser a Laravel package?
- No. It is explicitly a Symfony package built around symfony/browser-kit and the Symfony Kernel, and it ships no Laravel service provider, facade, or testing trait. Laravel's own HTTP test layer and Dusk already cover that niche. Treat it as a Symfony tool, not a Composer dependency for a Laravel estate.
- Can I use zenstruck/browser in a Laravel application?
- Not realistically. Its KernelBrowser drives the Symfony kernel and its PantherBrowser wraps symfony/panther, so there is no integration with Illuminate\Foundation\Testing\TestCase. You would be fighting the framework instead of gaining the fluent DSL. For Laravel, use MakesHttpRequests with TestResponse, Dusk, or Pest's browser testing.
- How do I install zenstruck/browser?
- Run composer require zenstruck/browser --dev. On Symfony, optionally register Zenstruck\Browser\Test\BrowserExtension in phpunit.xml, using the extension tag for PHPUnit 8 or 9 and the bootstrap class attribute for PHPUnit 10 and later. Then add the HasBrowser trait to your test classes. No production code, config, or container changes are required.
- Which PHPUnit versions does zenstruck/browser support?
- Installation differs by PHPUnit major version. PHPUnit 8 and 9 use the extension class form in phpunit.xml, while PHPUnit 10 and later use the bootstrap class form. The package is dev-only and does not pin a Laravel version because it is not a Laravel package. Check the release constraints on Packagist before upgrading.
- How is zenstruck/browser different from Laravel's HTTP tests or Dusk?
- Laravel's MakesHttpRequests and TestResponse already provide fluent HTTP assertions, and Dusk handles real-browser coverage. zenstruck/browser targets Symfony's WebTestCase and KernelTestCase, replacing verbose $client->request and $crawler->filter chains with a readable, auto-completable DSL. That is conceptual value for Laravel teams, not a drop-in replacement.
- What does a zenstruck/browser test look like?
- You call $this->browser() and chain calls like visit, assertSuccessful, assertSeeIn, fillField, click, and assertOn. Every call returns the browser, so the whole flow reads top to bottom. It pairs well with zenstruck/foundry for factory-created fixtures. The PHPUnit extension can also capture source and screenshots when a test fails.
- Does zenstruck/browser support JavaScript or real browser testing?
- Yes, through PantherBrowser, which wraps symfony/panther. That implies Chrome and a reachable web server in CI, a materially larger commitment than plain kernel tests. The package's own CI pins Playwright 1.62.1, but that is upstream's harness and not something your application inherits. Only take this path if JavaScript coverage is genuinely in scope.
- Is zenstruck/browser safe to use in production?
- It is a dev-only Composer dependency, so it should never ship to production. The worst case is deleting the package and reverting to native assertions. It cannot affect production traffic. Keep it in require-dev and out of your deployment artifact.
- What changed in zenstruck/browser v1.13.0 and is it a breaking change?
- The browser now fails when acted upon after an expected exception instead of silently continuing, which closes a misleading-green-build trap. The HTTP session can also be injected into use(), and artifact filenames are unique under ParaTest. Treat the exception behavior as a semi-breaking patch: suites on 1.12 or lower that caught an exception and kept asserting may now fail. State leakage was improved because merging per-request options no longer mutates the default HTTP options.
- Is zenstruck/browser actively maintained?
- It is MIT-licensed, has around 229 GitHub stars, and is effectively a single-maintainer project led by Zenstruck, though v1.13.0 shows external contributors landing fixes. That is a mild positive signal for bus factor. Reported metadata such as zero dependents and an unusual release date should be verified against Packagist and GitHub before citing it in a business case. Overall technical risk is contained because it is dev-only.