libre-informatique/decorator-bundle
Libre Informatique Decorator Bundle provides reusable decorator-pattern support for Symfony applications, letting you wrap services or objects with extra behavior while keeping core classes clean and extensible.
Reality check before anything else. libre-informatique/decorator-bundle is a Symfony bundle, not a Laravel package. There is no DecoratorServiceProvider, no facade, no extra.laravel.providers entry, and no config file Laravel would auto-discover. composer require it in a Laravel app and the *Bundle class is dead code — at best you end up using whatever plain PHP classes live under src/ as a raw library. The realistic day-to-day leverage for a Laravel developer is the pattern, not the package.
If you are actually on Symfony (or spiking on one), the minimal steps are:
composer require libre-informatique/decorator-bundle
// config/bundles.php
return [
// ...
LibreInformatique\DecoratorBundle\DecoratorBundle::class => ['all' => true],
];
Where to look first. There is no meaningful README, so the source is the documentation. Read in this order:
src/DependencyInjection/ — the Extension and Configuration classes tell you what the bundle actually registers and what knobs exist.src/Resources/config/ — the services.yaml/.xml that wires the decorator machinery.*Bundle class — expect a small Decorator/, Attribute/, or abstract base class. That folder is the entire value proposition.composer.json — check the PHP floor and Symfony constraints before you invest time; this vendor's code is likely Symfony 3/4-era.First use case. The bundle exists to wrap services so you can add behaviour (logging, caching, validation, formatting) without editing the wrapped class. The smallest meaningful exercise on Symfony is a wrapper around one of your own interfaces:
final class LoggingPriceCalculator implements PriceCalculatorInterface
{
public function __construct(private PriceCalculatorInterface $inner) {}
public function calculate(Basket $basket): Money
{
$result = $this->inner->calculate($basket);
// log $basket and $result
return $result;
}
}
# services.yaml
App\Pricing\PriceCalculator: ~
App\Pricing\LoggingPriceCalculator:
decorates: App\Pricing\PriceCalculator
arguments: ['@.inner']
If PriceCalculator::calculate() is still reached and your log line fires, the wiring works. Everything else in the bundle is a convenience layer over that mechanism — and Sym
How can I help you explore Laravel packages today?