GuzzleHttp\Client vs. Symfony\Panther\Client), reducing vendor lock-in and simplifying library/SDK development.Log::channel()) by dynamically resolving PSR-3 loggers or PSR-6 caches without manual binding.psr-discovery/http-client) to simplify dependency management for SDKs or plugins.Handler::render) must be extended to gracefully manage these cases.new GuzzleClient()), this package may not be leveraged. Requires cultural shift toward PSR interfaces.Illuminate\Http\Client, logging in Illuminate\Support\Facades\Log?)app()->make()) or complement it?Psr\Log\LoggerInterface).cache(), event())?Http::macro() or third-party SDKs).Illuminate\Cache\Repository) without hardcoding drivers.Event::dispatch() with PSR-14 dispatchers in modular packages.GuzzleHttp\Client for a mock in unit tests).Phase 1: Opt-In Discovery
discover() helper in Illuminate\Support\Facades\Facade to resolve PSR interfaces dynamically.use Psr\Log\LoggerInterface;
$logger = discover(LoggerInterface::class); // Falls back to default if no binding/discoverable class exists.
composer.json for common PSR implementations (e.g., psr-discovery/http-client).Phase 2: Facade Integration
Log, Cache) to use discovery as a fallback:
// In Illuminate\Support\Facades\Log
public static function channel($name = null) {
return tap(discover(LoggerInterface::class, $name), function ($logger) {
// ...
});
}
Phase 3: SDK/Plugin Standard
discover() for PSR dependencies").laravel-discovery meta-package bundling common PSR implementations.Http::macro()).Log and Cache facades.new GuzzleClient() with discover()).tinker or dd() may need enhancements to show discovery paths.php artisan discover:list to inspect discoverable classes.app->bind() overrides discovery).composer dump-autoload required after adding new implementations).How can I help you explore Laravel packages today?