alias(Http::class, 'http') ->share('http', [$this, 'getHttpService'], true); $container->alias(HttpFactory::class, 'http.factory') ->share('http.factory', [$this, 'getHttpFactoryService'], true); } /** * Get the `http` service * * @param Container $container The DI container. * * @return Http */ public function getHttpService(Container $container): Http { /** @var HttpFactory $factory */ $factory = $container->get('http.factory'); return $factory->getHttp(); } /** * Get the `http.factory` service * * @param Container $container The DI container. * * @return HttpFactory */ public function getHttpFactoryService(Container $container): HttpFactory { return new HttpFactory; } }