typhoon/reflection
Static, fast alternative to PHP’s native Reflection. Reflects code without running or autoloading it, uses lazy loading + caching, and stays compatible with native reflection. Supports Psalm/PHPStan phpDoc types, template resolution, and avoids memory leaks (safe with zend.enable_gc=0).
ReflectionClass, ReflectionMethod, etc., via native adapters. Reduces refactoring risk for teams using reflection for ORM (Eloquent), service containers, or middleware.@Route, @Middleware) by enabling richer static analysis of docblocks, improving IDE tooling and CI validation.Container::build() for faster binding resolution.getMorphClass(), getTable()).Illuminate\Support\Facades\Reflection).illuminate/support/Traits/ForwardsCalls).Illuminate\Contracts\Container\BindingResolutionException).Illuminate\Macroable traits) that might break compatibility?ReflectionClass in Illuminate\Container\Container::build().getConnection() or getTable() methods to use static reflection for metadata.Illuminate\Routing\Router.Illuminate\Pipeline\Pipeline.Cache::remember) to store reflection results, with TTLs based on class stability (e.g., 1 hour for config classes, 1 day for models).new ReflectionClass($job) with Typhoon\Reflection\ReflectionClass::fromClass($job).Illuminate\Container\Container::resolveClass() to delegate to Typhoon.Builder to use static reflection for metadata.Reflection facade to proxy to Typhoon.Typhoon\Reflection\NativeReflectionAdapter to wrap native reflection calls where Typhoon isn’t available (e.g., third-party libraries).Illuminate\Database\Eloquent\Model) to ensure parity.typhoon/reflection to composer.json with strict version constraints (e.g., ^0.4). Monitor for breaking changes in minor releases.Typhoon\Reflection\ReflectionMethod instead of native").<!-- psalm.xml -->
<file-list>
<directory name="vendor/typhoon-php/reflection/src" />
</file-list>
Illuminate\Support\Traits\Macroable?").App\Models\User) during Laravel boot.Config::afterLoading, Model::booted).composer dump-autoload).vendor/bin/psalm --init
ReflectionClass::getProperties() → Typhoon\Reflection\ReflectionClass::getProperties()).How can I help you explore Laravel packages today?