symfony/deprecation-contracts
Provides the global trigger_deprecation() helper to emit standardized, silenced deprecation notices with package name and version. Works with custom error handlers (e.g., Symfony ErrorHandler) to catch and log deprecations in dev and production.
Symfony\Component\ErrorHandler), requiring minimal architectural disruption.App\Exceptions\Handler or Symfony\ErrorHandler).ErrorHandler) if not already present.composer require + minimal configuration (e.g., adding Symfony\ErrorHandler to config/app.php).symfony/error-handler dependency.ErrorRenderer) to log E_USER_DEPRECATED notices.symfony/deprecation-contracts vs. symfony/error-handler) could break notice visibility.trigger_deprecation() calls).function_exists() guard).README.md or UPGRADING.md.Symfony\ErrorHandler or a custom handler (e.g., Sentry, Monolog)?symfony/error-handler + log channel)?E_USER_DEPRECATED → E_USER_WARNING in dev)?4.2.0) align with Laravel’s release cadence?ErrorHandler, HttpKernel (for HTTP-based deprecation headers).E_USER_DEPRECATED to a dedicated deprecations channel.expectDeprecation() assertions (via custom test helpers).ErrorHandler setup (higher effort).laravel/legacy-auth).trigger_deprecation() to 2–3 deprecated methods.symfony/error-handler to composer.json (if missing).App\Exceptions\Handler to log deprecations (e.g., to storage/logs/deprecations.log).UPGRADING.md with deprecation policies.trigger_deprecation() is a no-op without error handlers.E_USER_DEPRECATED triggers.trigger_deprecation() stubs exist.| Step | Effort | Dependencies |
|---|---|---|
| Install package | Low | composer require |
| Configure handler | Medium | Symfony\ErrorHandler or Monolog |
| Add test coverage | Medium | CI pipeline access |
| Document policy | Low | UPGRADING.md |
| Enforce in CI | High | Custom GitHub Action/PHPUnit |
trigger_deprecation() calls).4.2.0 → 5.0.0).NewHelper instead").deprecations table).| Scenario | Impact | Mitigation |
|---|---|---|
| Error handler misconfigured | Deprecations silently ignored | CI test to verify notice visibility |
Global trigger_deprecation() stub |
All deprecations suppressed | Avoid in shared autoload paths |
| Log retention too aggressive | Historical deprecation data lost | Archive logs or use DB storage |
| Version strings incorrect | Downstream confusion | Enforce regex validation in CI |
trigger_deprecation() (e.g., "always at the start of deprecated methods").expectDeprecation() in PHPUnit).contributing.md as a required step for breaking changes.deprecation:scan Artisan command to list all active deprecations.legacyHelper() in v11.0").How can I help you explore Laravel packages today?