typhoon/declaration-id
Generate stable, unique IDs for PHP declarations (classes, functions, methods, properties) to track and reference code elements across analyses and tooling. Lightweight package with strict typing and static-analysis-friendly design.
bind('App\Services\Foo', Foo::class) with bind(DeclarationId::of(Foo::class), Foo::class).DeclarationId::of(Foo::class) in Laravel\Log).phpstan, psalm) with unambiguous references.@inject('view_id', DeclarationId::of(View::make('foo')))).Str::macro() registrations).DeclarationId::of(FooListener::class).Adopt if:
laravel/ide-helper).Look elsewhere if:
app:bind with string literals) and don’t want to introduce a third-party dependency.For Executives: *"This package solves a hidden pain point in Laravel: manual dependency binding errors and ambiguous service identifiers. By adopting it, we can:
AppServiceProvider.For Engineering:
*"Typhoon’s declaration-id gives us a battle-tested way to generate unique, collision-free IDs for Laravel classes/services. Here’s why it’s worth adopting:
bind('App\Services\Foo', Foo::class) with bind(DeclarationId::of(Foo::class), Foo::class) to eliminate string typos.DeclarationIdResolver service to auto-bind classes in AppServiceProvider.For Developers: *"This package lets us stop guessing service names and let the computer generate them. For example:
// Before: Manual binding (error-prone)
bind('App\Services\AnalyticsService', AnalyticsService::class);
// After: Auto-generated ID (stable, no typos)
bind(DeclarationId::of(AnalyticsService::class), AnalyticsService::class);
Why it matters:
ClassNotFoundException from typos.composer require typhoon/declaration-id.DeclarationId::of(Foo::class) → outputs a unique hash.How can I help you explore Laravel packages today?