ruflin/elastica
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
elasticsearch/elasticsearch | v7.17.2 | - | (Apache-2.0 OR LGPL-2.1-only) | prod | |
nyholm/dsn | 2.0.1 | 13.9 kB | MIT | prod | |
psr/log | 3.0.0 | 6.77 kB | MIT | prod | |
symfony/deprecation-contracts | v3.5.0 | - | MIT | prod | |
symfony/polyfill-php73 | v1.29.0 | 4.15 kB | MIT | prod |
The ruflin/elastica package is a sophisticated Elasticsearch client for PHP. With the ability to manage compatibility with all Elasticsearch 7.0 releases and onwards, the package simplifies Elasticsearch integration into your PHP projects. It aims to stay aligned with Elasticsearch's lifecycle, making it easier to keep your applications updated with the latest improvements in Elasticsearch.
To use ruflin/elastica in your PHP programs, you'll first need to install it via Composer. Simply run composer require ruflin/elastica
in your project directory. Once the package is installed, you can use it to interact with your Elasticsearch instance. Here is a basic example of how to create a client, index a document, and perform a search:
require 'vendor/autoload.php';
$client = new \Elastica\Client();
$index = $client->getIndex('test');
$index->create([], true);
$doc = new \Elastica\Document(1, ['username' => 'ruflin']);
$index->addDocument($doc);
$index->refresh();
$query = new \Elastica\Query(['query' => ['match_all' => new \stdClass()]]);
$results = $index->search($query);
In this code, we're establishing a connection to Elasticsearch, creating an index, indexing a document, and then executing a simple match-all query.
The comprehensive documentation for ruflin/elastica can be accessed at Elastica.io. This is the primary source for understanding the package's functionality and getting to grips with its features. If you have specific questions about using ruflin/elastica, you can ask them on Stack Overflow using the "Elastica" tag, or in the project's Gitter channel. Any issues with the library should be reported on the GitHub issue tracker.