jolicode / elastically

🔍 JoliCode's Elastica wrapper to bootstrap Elasticsearch PHP integrations
248 stars 37 forks source link

Support DSN configuration style for Elastica client #112

Open Tristan971 opened 1 year ago

Tristan971 commented 1 year ago

In Elastically's client's constructor, initialisation of the factory is triggered in the following line:

https://github.com/jolicode/elastically/blob/06218e528b301e95b5167dc9b73cc5fc3ae9c5d2/src/Client.php#L37-L38

This causes Elastically to require an array-style configuration for Elastica, even Elastica supports DSN-style configuration. This causes an issue when trying to use a DSN:

In Factory.php line 53:

  JoliCode\Elastically\Factory::__construct(): Argument #1 ($config) must be of type array, string given, called in .../vendor/jolicode/elastically/src/Client.php on line 38                                                                                

It would probably look nicer in general to have the Elastica client instance split away from the Elastically one

lyrixx commented 1 year ago

I like it. Would you mind to submit a PR?

Tristan971 commented 1 year ago

I can sketch something out in the next few days and see if it looks good