Skip to content

Commit

Permalink
Properly register binding of psr http client and aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesvdvreken committed Sep 17, 2020
1 parent f34cdd4 commit b97a807
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Support/Laravel/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function provides(): array
return [
Client::class,
ClientInterface::class,
PsrClientInterface::class,
HandlerStack::class,
];
}
Expand All @@ -34,12 +35,12 @@ public function provides(): array
public function register(): void
{
// Configuring all guzzle clients.
$this->app->bind(ClientInterface::class, function(): PsrClientInterface {
$this->app->bind(PsrClientInterface::class, function(): PsrClientInterface {
// Guzzle client
return new Client(['handler' => $this->app->make(HandlerStack::class)]);
});

$this->app->alias(ClientInterface::class, Client::class);
$this->app->alias(PsrClientInterface::class, Client::class);
$this->app->alias(PsrClientInterface::class, ClientInterface::class);

// Bind if needed.
Expand Down

0 comments on commit b97a807

Please sign in to comment.