ruudk/deprecation-contracts-with-backtrace

A generic function and convention to trigger deprecation notices

Installs: 1 009

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 10

pkg:composer/ruudk/deprecation-contracts-with-backtrace

v3.6.0 2025-12-18 10:41 UTC

This package is auto-updated.

Last update: 2025-12-18 10:54:15 UTC


README

A drop-in replacement for symfony/deprecation-contracts that includes a backtrace in deprecation messages.

The Problem

When Symfony or other packages trigger deprecation warnings, you often see messages like:

Since symfony/framework-bundle 6.4: The "foo" option is deprecated.

But where is this deprecation triggered from? Without a backtrace, you have to search your entire codebase to find the source.

The Solution

This package adds a backtrace to every deprecation message, so you'll see:

Since symfony/framework-bundle 6.4: The "foo" option is deprecated.
/var/www/app/src/Controller/MyController.php:42
/var/www/app/src/Service/MyService.php:87
/var/www/app/vendor/symfony/framework-bundle/Controller/AbstractController.php:123
...

Now you can immediately see where the deprecation is being triggered.

Installation

composer require ruudk/deprecation-contracts-with-backtrace

That's it! The package uses Composer's replace directive to automatically replace symfony/deprecation-contracts. No configuration needed.

How it Works

This package provides the same trigger_deprecation() function as Symfony's deprecation-contracts, but appends a backtrace (up to 10 frames) to the deprecation message. Since it declares "replace": {"symfony/deprecation-contracts": "self.version"} in its composer.json, Composer will use this package instead of the original.

License

MIT License - see the LICENSE file for details.

Based on symfony/deprecation-contracts by Fabien Potencier and the Symfony Community.