Weave 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
Phpunit Bridge

Phpunit Bridge Laravel Package

symfony/phpunit-bridge

PHPUnit Bridge adds utilities on top of PHPUnit, with a focus on managing deprecation notices in your test suite. It helps you track, report, and fix deprecations so your code stays compatible with future Symfony and PHP versions.

View on GitHub
Deep Wiki
Context7

Symfony PHPUnit Bridge is a utility package that enhances PHPUnit with tools designed for Symfony applications and libraries. Its core purpose is managing deprecation notices, helping you detect and resolve outdated code before major upgrades.

The bridge integrates seamlessly into your test suite, surfacing deprecations raised by your code and dependencies so they can be tracked, baselined, and fixed over time.

  • Deprecation management — collect, group, and report user deprecation notices during test runs
  • Baseline support — ignore known deprecations while catching new ones
  • Legacy test compatibility — run tests against multiple PHPUnit versions
  • Clock mocking — deterministic time-based tests
  • Simple setup — drop-in simple-phpunit script for isolated test environments
Frequently asked questions about Phpunit Bridge
What is symfony/phpunit-bridge used for in Laravel projects?
It is a dev-only test utility for PHPUnit that focuses on tracking and managing deprecation notices, especially Symfony deprecations. Laravel teams use it when upgrading PHP, Laravel, or Symfony components and need actionable deprecation counts in CI. It also provides ClockMock, DnsMock, and PHPUnit compatibility shims, but it is not a general Laravel testing framework.
How do I install symfony/phpunit-bridge in a Laravel app?
Add it with composer require --dev symfony/phpunit-bridge, then wire its bootstrap or deprecation helper into phpunit.xml or your CI test command. Start in warn-only or non-blocking mode, capture a baseline, and only then enforce thresholds. Keep the change isolated to dev dependencies so rollback is simple.
Does symfony/phpunit-bridge work with Laravel artisan test and PHPUnit?
It operates at the PHPUnit layer, so Laravel's artisan test can use it when PHPUnit is invoked with the bridge bootstrap or listener configuration. Laravel's test wrapper and custom listeners can affect behavior, so validate it in a pilot before enforcing deprecation gates. Pin the bridge version and confirm the behavior of your exact PHPUnit and Laravel test setup.
How do I configure symfony/phpunit-bridge deprecation handling in phpunit.xml?
Configure the bridge via its deprecation helper settings and environment variables such as SYMFONY_DEPRECATIONS_HELPER in phpunit.xml or CI. Begin with weak or non-blocking reporting, quarantine known third-party deprecations, and then gate only actionable direct deprecations. Avoid hard-failing on the first run because a baseline refresh can otherwise flood CI with existing noise.
Which Laravel, PHP, and PHPUnit versions does symfony/phpunit-bridge support?
The package does not declare a Laravel version constraint; compatibility depends on your PHP, PHPUnit, Symfony component, and Laravel test-runner versions. Pin the bridge and include PHPUnit and PHP upgrades in your compatibility matrix, especially for Pest or heavily customized suites. Validate against your actual CI images rather than assuming broad Laravel version support.
Does symfony/phpunit-bridge support Pest or parallel testing?
Use it with Pest or parallel testing only after an explicit spike. The bridge patches PHPUnit TestCase and bootstrap behavior and can conflict with custom listeners or parallel runners. If it works in your setup, pin it, isolate configuration, and verify deprecation counts in CI before enforcing gates.
What changed in symfony/phpunit-bridge v8.1.9 for __sleep and __wakeup deprecations?
v8.1.9 no longer silences __sleep and __wakeup deprecations, so legacy serialization magic methods may add entries to your deprecation baseline. Treat the release as a reporting change rather than an API break, and re-capture the baseline before enforcing thresholds. Pin the version so this behavior change is adopted deliberately.
Are ClockMock and DnsMock useful in Laravel tests?
ClockMock and DnsMock help make time- and DNS-dependent tests deterministic, which can replace flaky custom mocks. They are optional utilities, not requirements, so adopt them only where they solve real test instability. Validate them against your Laravel test setup before standardizing across the suite.
Is symfony/phpunit-bridge safe to use in production?
No, it is test infrastructure and should be installed with composer require --dev rather than shipped as a runtime dependency. Its MIT license is low legal risk, and production behavior is unaffected because it is not loaded by the application. Keep it out of production autoload paths and treat it as part of your CI toolchain.
What are alternatives to symfony/phpunit-bridge for Laravel deprecation tracking?
Native PHPUnit deprecation output and custom error handlers are alternatives, and Laravel or PHPUnit upgrades may cover simpler needs. The Symfony bridge is strongest when you want categorized Symfony deprecations, thresholds, ClockMock, and DnsMock. If you do not use Symfony components or need vendor SLA, a lighter native approach may fit better.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource