Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 16, 2024 via composer

elasticsearch/elasticsearch v8.11.0

PHP Client for Elasticsearch
Package summary
Share
0
issues
1
license
13
MIT
Package created
24 Sep 2013
Version published
11 Nov 2023
Maintainers
1
Total deps
13
Direct deps
4
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
13 Packages, Including:
elastic/transport@v8.8.0
elasticsearch/elasticsearch@v8.11.0
guzzlehttp/guzzle@7.8.1
guzzlehttp/promises@2.0.2
guzzlehttp/psr7@2.6.2
php-http/discovery@1.19.4
php-http/httplug@2.4.0
php-http/promise@1.3.1
psr/http-client@1.0.3
psr/http-factory@1.1.0
psr/log@3.0.0
ralouphie/getallheaders@3.0.3
symfony/deprecation-contracts@v3.5.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

4
All Dependencies CSV
β“˜ This is a list of elasticsearch/elasticsearch 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
elastic/transportv8.8.0-MIT
prod
guzzlehttp/guzzle7.8.1112.34 kBMIT
prod
psr/http-client1.0.3-MIT
prod dev
psr/log3.0.06.77 kBMIT
prod dev

Visualizations

Frequently Asked Questions

What does elasticsearch/elasticsearch do?

The Elasticsearch PHP client, also known as "elasticsearch/elasticsearch," is the official PHP client for Elasticsearch. It offers over 400 endpoints to interact with Elasticsearch, facilitating operations such as indexing, searching, updating, and deleting documents. The client is designed to have compatibility with the Elasticsearch server and is versioned and released alongside it. Notably, the 8.0.0 version supports PSR-7 for HTTP messages and PSR-18 for HTTP client communications, reflecting a new approach compared to the 7.x version.

How do you use elasticsearch/elasticsearch?

To utilize the elasticsearch/elasticsearch PHP client, it first needs to be installed in your project. This can typically be done via composer. Upon completion of installation, you can connect to Elasticsearch by referencing the Getting Started documentation's Connecting section. Subsequent usage to index, search, or delete content involves calling relevant API endpoints. For instance, to mock the Elasticsearch client, you may use the PHP-HTTP mock client and implement it as displayed in the README's provided code sample. Attention should be paid to ensure version compatibility between your Elasticsearch server and the PHP client for assured interoperability.

Here is a sample of code to establish an Elasticsearch client and mock an HTTP response:

use Elastic\Elasticsearch\ClientBuilder;
use Elastic\Elasticsearch\Response\Elasticsearch;
use Http\Mock\Client;
use Nyholm\Psr7\Response;

$mock = new Client(); // This is the mock client

$client = ClientBuilder::create()
    ->setHttpClient($mock)
    ->build();

// This is a PSR-7 response
$response = new Response(
    200, 
    [Elasticsearch::HEADER_CHECK => Elasticsearch::PRODUCT_NAME],
    'This is the body!'
);
$mock->addResponse($response);

$result = $client->info(); // Just calling an Elasticsearch endpoint

echo $result->asString(); // This is the body!

Where are the elasticsearch/elasticsearch docs?

The comprehensive documentation for the Elasticsearch PHP client is available on the Elastic website. Specifically, the documents cover topics such as the installation, connecting to Elasticsearch, usage examples for various tasks, versioning, and information about backward incompatible changes. Information about endpoints for interacting with Elasticsearch is also available in the official Elasticsearch APIs documentation. In case you need to report issues with the client or seek help, the Elastic community discuss forums can be quite helpful.