Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
babenkoivan committed Jul 26, 2022
1 parent 7b6e247 commit c78a187
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,36 @@ return [
];
```

If you need more control over the client creation, you can create your own client builder:

```php
// see Elastic\Client\ClientBuilder for the reference
class MyClientBuilder implements Elastic\Client\ClientBuilderInterface
{
public function default(): Client
{
// should return a client instance for the default connection
}

public function connection(string $name): Client
{
// should return a client instance for the connection with the given name
}
}
```

Do not forget to register the builder in your application provider:

```php
class MyAppProvider extends Illuminate\Support\ServiceProvider
{
public function register()
{
$this->app->singleton(ClientBuilderInterface::class, MyClientBuilder::class);
}
}
```

## Usage

Use `Elastic\Client\ClientBuilderInterface` to get access to the client instance:
Expand Down

0 comments on commit c78a187

Please sign in to comment.