From 08376fe5185026ef81085327e17536a49f47e833 Mon Sep 17 00:00:00 2001 From: Oh My Felix Date: Mon, 22 Jun 2026 16:04:43 +0000 Subject: [PATCH 1/2] Docs: move documentation to README Co-authored-by: Felix --- .docs/README.md | 93 ----------------------------------------------- README.md | 95 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 86 insertions(+), 102 deletions(-) delete mode 100644 .docs/README.md diff --git a/.docs/README.md b/.docs/README.md deleted file mode 100644 index 500b542..0000000 --- a/.docs/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# Elastica - -## Content - -- [Setup](#usage) -- [Configuration](#configuration) -- [Usage](#usage) -- [Monolog](#monolog) - -This extension integrates the [ruflin/elastica](https://github.com/ruflin/Elastica) into Nette Framework. -For more information on how to use Elastica [read the official documentation](http://Elastica.io/). - -## Setup - -```bash -composer require contributte/elastica -``` -register extension - -```neon -extensions: - elastica: Contributte\Elastica\DI\ElasticaExtension -``` - - -## Configuration - -Define at least one host, this would be minimal possible config. - -```neon -elastica: - config: - host: localhost -``` - -Full config with all possible options. -```neon -elastica: - debug: %debugMode% - config: - host: null - port: null - path: null - url: null - proxy: null - transport: null - compression: false - persistent: true - timeout: null - connections: [] - roundRobin: null - retryOnConflict: 0 - bigintConversion: null - username: null - password: null - auth_type: null - curl: [] - headers: [] -``` - -Extension does not pass any unset values to elastica so elastica defaults just work. -Take a look to [Elastica docs](https://elastica-docs.readthedocs.io/en/latest/client.html#client-configurations). - -In docker environment you should use `host: elasticsearch` and `port: 9200` for example. - -## Usage - -Extension registers `Contributte\Elastica\Client` to DI container. - -```php -class YourService -{ - /** @var \Contributte\Elastica\Client */ - private $elasticaClient; - - public function __construct(Contributte\Elastica\Client $elastica) - { - $this->elasticaClient = $elastica; - } -} -``` - -## Monolog - -You can use monolog to log errors to kibana. - -Just register ElasticaHandler in monolog setup. - - - Monolog\Handler\ElasticaHandler - -## Inspiration - -Inspired by [Filip Procházka](https://github.com/fprochazka) package [kdyby/ElasticSearch](https://github.com/Kdyby/ElasticSearch). diff --git a/README.md b/README.md index 7d23c7e..16d7f3d 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,18 @@ Website 🚀 contributte.org | Contact 👨🏻‍💻 f3l1x.io | Twitter 🐦 @contributte

-## Usage +Nette Framework extension for integrating the [ruflin/elastica](https://github.com/ruflin/Elastica) Elasticsearch client. + +For more information on how to use Elastica, read the [official documentation](https://elastica.io/). + +## Versions + +| State | Version | Branch | Nette | PHP | +|-------------|---------|----------|-------|---------| +| dev | `^2.1` | `master` | 3.1+ | `>=8.1` | +| stable | `^2.0` | `master` | 3.1+ | `>=8.1` | + +## Installation To install latest version of `contributte/elastica` use [Composer](https://getcomposer.org). @@ -26,22 +37,88 @@ To install latest version of `contributte/elastica` use [Composer](https://getco composer require contributte/elastica ``` -## Documentation +Register extension: -For details on how to use this package, check out our [documentation](.docs). +```neon +extensions: + elastica: Contributte\Elastica\DI\ElasticaExtension +``` -## Versions +## Configuration -| State | Version | Branch | Nette | PHP | -|-------------|---------|----------|-------|---------| -| dev | `^2.1` | `master` | 3.1+ | `>=8.1` | -| stable | `^2.0` | `master` | 3.1+ | `>=8.1` | +Define at least one host, this would be minimal possible config. + +```neon +elastica: + config: + host: localhost +``` + +Full config with all possible options. + +```neon +elastica: + debug: %debugMode% + config: + host: null + port: null + path: null + url: null + proxy: null + transport: null + compression: false + persistent: true + timeout: null + connections: [] + roundRobin: null + retryOnConflict: 0 + bigintConversion: null + username: null + password: null + auth_type: null + curl: [] + headers: [] +``` + +Extension does not pass any unset values to elastica so elastica defaults just work. +Take a look to [Elastica docs](https://elastica-docs.readthedocs.io/en/latest/client.html#client-configurations). + +In docker environment you should use `host: elasticsearch` and `port: 9200` for example. + +## Usage + +Extension registers `Contributte\Elastica\Client` to DI container. + +```php +class YourService +{ + /** @var \Contributte\Elastica\Client */ + private $elasticaClient; + + public function __construct(Contributte\Elastica\Client $elastica) + { + $this->elasticaClient = $elastica; + } +} +``` + +## Monolog + +You can use Monolog to log errors to Kibana. + +Just register ElasticaHandler in monolog setup. + +- `Monolog\Handler\ElasticaHandler` + +## Inspiration + +Inspired by [Filip Procházka](https://github.com/fprochazka) package [kdyby/ElasticSearch](https://github.com/Kdyby/ElasticSearch). ## Development See [how to contribute](https://contributte.org/contributing.html) to this package. -This package is currently maintaining by these authors. +This package is currently maintained by these authors. From a4256749947841c0764b1a790a26aa816a7bdea6 Mon Sep 17 00:00:00 2001 From: Oh My Felix Date: Tue, 7 Jul 2026 17:06:29 +0000 Subject: [PATCH 2/2] Docs: polish README migration Co-authored-by: Felix --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 16d7f3d..baebf73 100755 --- a/README.md +++ b/README.md @@ -81,19 +81,18 @@ elastica: ``` Extension does not pass any unset values to elastica so elastica defaults just work. -Take a look to [Elastica docs](https://elastica-docs.readthedocs.io/en/latest/client.html#client-configurations). +Take a look at [Elastica docs](https://elastica-docs.readthedocs.io/en/latest/client.html#client-configurations). -In docker environment you should use `host: elasticsearch` and `port: 9200` for example. +In a Docker environment, you can use `host: elasticsearch` and `port: 9200`, for example. ## Usage -Extension registers `Contributte\Elastica\Client` to DI container. +The extension registers `Contributte\Elastica\Client` in the DI container, so you can inject it into your services. ```php class YourService { - /** @var \Contributte\Elastica\Client */ - private $elasticaClient; + private Contributte\Elastica\Client $elasticaClient; public function __construct(Contributte\Elastica\Client $elastica) {