File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,36 @@ return [
6262];
6363```
6464
65+ If you need more control over the client creation, you can create your own client builder:
66+
67+ ``` php
68+ // see Elastic\Client\ClientBuilder for the reference
69+ class MyClientBuilder implements Elastic\Client\ClientBuilderInterface
70+ {
71+ public function default(): Client
72+ {
73+ // should return a client instance for the default connection
74+ }
75+
76+ public function connection(string $name): Client
77+ {
78+ // should return a client instance for the connection with the given name
79+ }
80+ }
81+ ```
82+
83+ Do not forget to register the builder in your application provider:
84+
85+ ``` php
86+ class MyAppProvider extends Illuminate\Support\ServiceProvider
87+ {
88+ public function register()
89+ {
90+ $this->app->singleton(ClientBuilderInterface::class, MyClientBuilder::class);
91+ }
92+ }
93+ ```
94+
6595## Usage
6696
6797Use ` Elastic\Client\ClientBuilderInterface ` to get access to the client instance:
You can’t perform that action at this time.
0 commit comments