Repository navigation
Conversation
Member
Author
|
Raised the minimum PHP to >=8.2 (composer, phpstan/phpcs php_version, CI matrix, README). The PHP 8.1 jobs could not install because contributte/qa ^0.4 and contributte/tester ^0.4 require PHP >=8.2. This also covers #18. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20 +/- ##
===========================================
+ Coverage 34.18% 87.27% +53.08%
===========================================
Files 3 4 +1
Lines 117 220 +103
===========================================
+ Hits 40 192 +152
+ Misses 77 28 -49 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f3l1x
commented
Oct 2, 2026
| ], | ||
| "require": { | ||
| "php": ">=8.1", | ||
| "ruflin/elastica": "^7.3.1", |
f3l1x
commented
Oct 2, 2026
| ``` | ||
| register extension | ||
|
|
||
| Elastica 8+ is built on top of [elastic/transport](https://github.com/elastic/elastic-transport-php), which needs a [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP client. |
f3l1x
commented
Oct 2, 2026
| Define at least one host, this would be minimal possible config. | ||
|
|
||
| ```neon | ||
| elastica: |
Member
Author
There was a problem hiding this comment.
Let's support multiple connections based on github.com/contributte/doctrine-dbal and github.com/contributte/doctrine-orm
f3l1x
commented
Oct 2, 2026
| headers: [] | ||
| retries: null # defaults to number of hosts | ||
| retryOnConflict: 0 | ||
| transport_config: |
f3l1x
commented
Oct 2, 2026
| In docker environment you should use `host: elasticsearch` and `port: 9200` for example. | ||
| In docker environment you should use `hosts: [http://elasticsearch:9200]` for example. | ||
|
|
||
| ### Upgrade from Elastica 7 |
f3l1x
commented
Oct 2, 2026
| ]; | ||
| $service = static fn () => Expect::anyOf(Expect::string(), Expect::type(Statement::class))->nullable(); | ||
|
|
||
| // https://github.com/ruflin/Elastica/blob/8.x/src/ClientConfiguration.php |
f3l1x
commented
Oct 2, 2026
| $builder = $this->getContainerBuilder(); | ||
| $config = $this->config; | ||
|
|
||
| /** @var array<string, mixed> $clientConfig */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ruflin/elastica7 pinselasticsearch/elasticsearch^7, socontributte/elasticacan't be installed next tocontributte/elasticsearchv0.6.0, which needselasticsearch/elasticsearch^8.11. With this PR they resolve together (checked with a path-repo dry run: elastica 8.2.0, elasticsearch-php 8.19.0, contributte/elasticsearch 0.6.0).Constraint:
ruflin/elastica: ^8.0 || ^9.0elastic/transport+elasticsearch/elasticsearch8). TheClientconstructor config,request(),Elastica\Request,getTransferInfo()andResponseExceptionare all gone or replaced. Supporting 7 and 8 together would need two clients, two config schemas and two panels, so I dropped 7 rather than offer dual support.Client/ClientConfigurationAPI is the same. The only 9.0 break that touches this package is the removal ofElastica\Request, and the code no longer uses it. One codebase covers both majors.>=8.1, since both majors support it. This doesn't conflict with Composer: require PHP >=8.2 #18.Changes
Client: the hooks now wrapsendRequest(RequestInterface): Elasticsearch, which every endpoint goes through, instead of the removedrequest(). The callbacks receive the PSR-7 request the transport actually sent (with the node host resolved).ElasticaExtension: new config schema that mirrors Elastica 8'sClientConfiguration/_buildTransport. New top-levelloggeroption (a PSR-3 service passed to the Elastica client). Null or empty values are not passed through, so Elastica's defaults still apply.scheme://host:port, with no user info, so credentials don't leak. The explain re-run now also covers POST_search, since ES client 8 sends searches with a body as POST. BlueScreen showsClientResponseException/ServerResponseExceptionresponses (the oldElastica\Exception\ResponseExceptionno longer exists).guzzlehttp/guzzleadded to require-dev. elastic/transport needs a PSR-18 client, and the package suggests one. Branch alias bumped to3.0.0-devbecause this is a BC break.contributte/qa0.4 removedruleset-8.0.xml, somake cswas already failing on master (and on Composer: require PHP >=8.2 #18). The ruleset now uses the baseruleset.xmlwithphp_version=80100. Stale phpstanignoreErrorsremoved; phpstan level 9 passes with no ignores.BC impact for users
Config migration (old keys are rejected by the schema, e.g.
Unexpected item 'elastica › config › host', did you mean 'hosts'?):host: es.local+port: 9200hosts: [http://es.local:9200]url: http://es.local:9200/hosts: [http://es.local:9200]connections: [...]hosts: [...]roundRobin: truetransport_config: node_pool: @nodePoolusername/passwordapi_key,cloud_id)auth_type,transport,proxy,curl,compression,persistent,timeout,headers,path,bigintConversiontransport_config: http_client/http_client_options)Other breaks:
guzzlehttp/guzzleorsymfony/http-client).onSuccess/onFailuresignatures changed to(Client, Psr\Http\Message\RequestInterface, Elastic\Elasticsearch\Response\Elasticsearch|Throwable, float).Panel::$queriesentries are now['request' => ..., 'response' => ..., 'time' => ..., 'exception' => ...]with PSR-7 objects.Elastic\Elasticsearch\Exception\ClientResponseException/ServerResponseException,Elastica\Requestis gone in 9, and so on). See the UPGRADE-8.0 and UPGRADE-9.0 guides.Test results (local, PHP 8.5)
--ignore-platform-req=php)Not run locally: the CI matrix on PHP 8.1/8.2/8.3, including
--prefer-loweston 8.1. CI on this PR covers that.Open questions
3.0) fine? The branch alias is bumped to3.0.0-dev, and2.xwould stay on Elastica 7..docsinto README, so whichever lands second needs a small rebase of the docs.