alsciende/make-registry-bundle
#[TaggedIterator] and #[AutoconfigureTag] attributes, which are well-supported in modern Symfony (6.0+). This aligns with Symfony’s declarative service configuration approach.make:registry.bindTagged()) can mimic registry behavior, but lose the MakerBundle convenience.#[TaggedIterator]). Workarounds (e.g., annotations) add complexity.Artisan doesn’t natively support Symfony’s MakerBundle commands without middleware.spatie/laravel-registry) be simpler?| Component | Symfony Fit | Laravel Fit | Mitigation Strategy |
|---|---|---|---|
| Dependency Injection | Native (autowiring, tags) | Partial (bindTagged, manual tags) | Use Laravel’s bindTagged() + custom registry class. |
| Command Line | MakerBundle integration | Artisan | Create a Laravel command wrapper or use Symfony CLI in CI. |
| Attributes | Native (PHP 8+) | Limited (<8.40) | Polyfill attributes or use annotations. |
| Service Tagging | #[TaggedIterator] |
bindTagged() |
Abstract tagging logic behind a facade. |
| Compiler Passes | Native | None | Replace with Laravel’s BootstrapServiceProvider. |
Symfony Projects:
composer require alsciende/make-registry-bundle).bundles.php).php bin/console make:registry <ServiceName>.Laravel Projects:
composer require symfony/maker-bundle symfony/dependency-injection).make:registry.bindTagged().// app/Providers/AppServiceProvider.php
public function register()
{
$this->app->bindTagged('output.formatter', OutputFormatterInterface::class);
$this->app->singleton(OutputFormatterRegistry::class, function ($app) {
return new OutputFormatterRegistry(
$app->tagged('output.formatter')
);
});
}
make:registry command to generate stubs.make:registry (Symfony) or a custom command (Laravel).| Risk | Symfony Impact | Laravel Impact | Mitigation |
|---|---|---|---|
| Duplicate Service Names | Throws LogicException at runtime. |
Same, but may require custom logic. | Validate names early (e.g., in tests). |
| Missing Tagged Services | Registry populates empty. | Same. | Use optional() or default fallbacks. |
| Attribute Parsing Errors | Fails if PHP 8 attributes missing. | Critical in Laravel <8.40. | Polyfill attributes or use annotations. |
| DI Container Conflicts | Rare (Symfony’s DI is stable). | Possible with hybrid setups. | Isolate Symfony DI in a separate process. |
| Command Integration | None (native support). | Fails if Artisan can’t proxy Symfony. | Use a wrapper script or custom CLI. |
How can I help you explore Laravel packages today?