egulias/tag-debug
Fetch and inspect tagged services from a Symfony DependencyInjection ContainerBuilder. TagFetcher returns tags grouped by tag name with service class, Tag metadata, and Definition. Supports composable AND filters (e.g., by tag name) or custom filters.
TaggedIterator and TaggedInterface abstractions, requiring a compatibility layer or abstraction.Illuminate\Events\Dispatcher).command.bus.bindIf, when).ContainerBuilder with Laravel’s Container or adapting the package to use Laravel’s ServiceProvider/Bootstrap hooks.getServiceIds() method like Symfony’s ContainerBuilder, necessitating a workaround (e.g., iterating over all bound services).bind()/tag() in AppServiceProvider, but the package expects Symfony’s tags attribute in YAML/XML. A custom TaggedService interface or annotation parser may be needed.app:debug command or packages like spatie/laravel-debugbar for similar functionality.TagFetcher to Laravel’s container.app:debug or a modern alternative if integration is too costly.bindWithTags) sufficient?symfony/dependency-injection (v2), which is not directly usable in Laravel. Options:
ContainerBuilder in isolation (e.g., for CLI tools).Container + custom tagging logic.app:debug: Lists all services but lacks tag filtering.ServiceProvider to log tagged services during boot.ContainerBuilder for testing (e.g., in a debug:tags Artisan command).use Egulias\TagDebug\Tag\TagFetcher;
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
// Manually load Laravel services into Symfony's container (complex)
$fetcher = new TagFetcher($container);
$tags = $fetcher->fetch(new FilterList());
app->getBindings().TaggedService interfaces or annotations.ContainerBuilder in a CLI command (e.g., php artisan debug:tags), but this requires duplicating service definitions.| Feature | Symfony 2 DIC | Laravel Container | Workaround Needed? |
|---|---|---|---|
| Tagged Services | tags: [tag1, tag2] |
Custom binding/traits | Yes (abstraction layer) |
| Service Definitions | YAML/XML | PHP/Annotations | Yes (manual mapping) |
| Filtering | FilterList |
Custom logic | Yes |
| CLI Integration | Built-in | Artisan commands | No (can wrap in CLI) |
ContainerBuilder (for proof of concept).| Scenario | Impact | Mitigation |
|---|---|---|
| Symfony API changes | Package breaks | Fork and update dependencies |
| Laravel container changes | Integration fails | Isolate behind abstraction layer |
| Runtime tag inspection | Slow requests | Restrict to CLI or cache results |
| Missing tag metadata | Incomplete debug output | Fallback to Laravel’s app:debug |
| PHP 8+ incompatibilities | Runtime errors | Patch package or use polyfills |
ContainerBuilder vs. Laravel’s Container.How can I help you explore Laravel packages today?