[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8338":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},8338,"elasticsearch-php","elastic\u002Felasticsearch-php","elastic","Official PHP client for Elasticsearch.","https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Findex.html",null,"PHP",5336,968,451,12,0,1,39.96,"MIT License",false,"main",[23,24,25],"client","elasticsearch","php","2026-06-12 02:01:52","\u003Cp align=\"center\">\n     \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Felastic\u002Felasticsearch-py\u002Fraw\u002Fmain\u002Fdocs\u002Fimages\u002Flogo-elastic-glyph-color.svg\" width=\"20%\" alt=\"Elastic logo\" \u002F>\n\u003C\u002Fp>\n\n# Elasticsearch PHP client\n\n[![Build status](https:\u002F\u002Fgithub.com\u002Felastic\u002Felasticsearch-php\u002Fworkflows\u002FPHP%20test\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Felastic\u002Felasticsearch-php\u002Factions) [![Latest Stable Version](https:\u002F\u002Fposer.pugx.org\u002Felasticsearch\u002Felasticsearch\u002Fv\u002Fstable)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Felasticsearch\u002Felasticsearch) [![Total Downloads](https:\u002F\u002Fposer.pugx.org\u002Felasticsearch\u002Felasticsearch\u002Fdownloads)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Felasticsearch\u002Felasticsearch)\n\nThis is the official PHP client for\n[Elasticsearch](https:\u002F\u002Fwww.elastic.co\u002Felasticsearch\u002F).\n\nYou can run [Elasticsearch](https:\u002F\u002Fwww.elastic.co\u002Felasticsearch) and [Kibana](https:\u002F\u002Fwww.elastic.co\u002Fkibana) on your local machine using this command:\n\n```bash\ncurl -fsSL https:\u002F\u002Felastic.co\u002Fstart-local | sh\n```\nor **[sign-up](https:\u002F\u002Fcloud.elastic.co\u002Fregistration?elektra=en-ess-sign-up-page)**\n**for a free trial of Elastic Cloud**.\n\n## Contents\n\n- [Installation](#installation)\n- [Connecting](#connecting)\n- [Usage](#usage)\n- [Versioning](#versioning)\n- [Backward Incompatible Changes](#backward-incompatible-changes-boom)\n- [Mock the Elasticsearch client](#mock-the-elasticsearch-client)\n- [FAQ](#faq-)\n- [Contribute](#contribute-)\n- [License](#license-)\n\n***\n\n## Installation\n\nRefer to the [Installation section](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_installation)\nof the getting started documentation.\n\n## Connecting\n\nRefer to the [Connecting section](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_connecting)\nof the getting started documentation.\n\n## Usage\n\nThe `elasticsearch-php` client offers 500+ endpoints for interacting with\nElasticsearch. A list of all these endpoints is available in the\n[official documentation](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Freference\u002Fcurrent\u002Frest-apis.html)\nof Elasticsearch APIs.\n\nHere we reported the basic operation that you can perform with the client:\nindex, search and delete.\n\n- [Creating an index](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_creating_an_index)\n- [Indexing a document](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_indexing_documents)\n- [Getting documents](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_getting_documents)\n- [Searching documents](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_searching_documents)\n- [Updating documents](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_updating_documents)\n- [Deleting documents](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_deleting_documents)\n- [Deleting an index](https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Fclient\u002Fphp-api\u002Fcurrent\u002Fgetting-started-php.html#_deleting_an_index)\n\n### Versioning\n\nThis client is versioned and released alongside Elasticsearch server.\n\nTo guarantee compatibility, use the most recent version of this library within\nthe major version of the corresponding Enterprise Search implementation.\n\nFor example, for Elasticsearch `8.16`, use `8.16` of this library or above, but\nnot `9.0`.\n\n## Compatibility\n\nThe Elasticsearch client is compatible with currently maintained PHP versions.\n\nLanguage clients are forward compatible; meaning that clients support\ncommunicating with greater or equal minor versions of Elasticsearch without\nbreaking. It does not mean that the client automatically supports new features\nof newer Elasticsearch versions; it is only possible after a release of a new\nclient version. For example, a 8.12 client version won't automatically support\nthe new features of the 8.13 version of Elasticsearch, the 8.13 client version\nis required for that. Elasticsearch language clients are only backwards\ncompatible with default distributions and without guarantees made.\n\n| Elasticsearch Version | Elasticsearch-PHP Branch | Supported |\n| --------------------- | ------------------------ | --------- |\n| main                  | main                     |           |\n| 9.x                   | 9.x                      | 9.x       |\n| 8.x                   | 8.x                      | 8.x       |\n\n## Backward Incompatible Changes :boom:\n\nThe 9.0.0 version of `elasticsearch-php` contains the same architecture of 8.x.\nIt supports [PSR-7](https:\u002F\u002Fwww.php-fig.org\u002Fpsr\u002Fpsr-7\u002F) for HTTP messages and\n[PSR-18](https:\u002F\u002Fwww.php-fig.org\u002Fpsr\u002Fpsr-18\u002F) for HTTP client communications.\n\nWe tried to avoid BC breaks for `9.x`, here the main changes:\n\n- **Compatibility with Elasticsearch 9.0:** All changes and additions to Elasticsearch APIs for its 9.0 release are reflected in this release.\n- **Serverless client merged in:** the `elastic\u002Felasticsearch-serverless` client is being deprecated, and its functionality has been merged back into this client. This should have zero impact on the way the client works by default. If an endpoint is available in serverless, the PHP function will contains a `@group serverless` phpdoc attribute.\nIf you try to use an endpoint that is not available in serverless you will get a `410` HTTP error with a message as follows:\n\"this endpoint exists but is not available when running in serverless mode\".\nThe 9.0.0 client can recognize that it is communicating with a serverless instance if you are using a URL managed by Elastic (e.g. `*.elastic.cloud`).\nIf you are using a proxy, the client will be able to recognize that the host is serverless from the first response. Alternatively, you can explicitly indicate that the host is serverless using the `Client::setServerless(true)` function (`false` by default).\n- **New transport library with PSR-18 cURL client as default:** we've removed the Guzzle dependency from the client. By default, the built-in cURL-based HTTP client will be used if no other PSR-18 compatible clients are detected. See release [9.0.0](https:\u002F\u002Fgithub.com\u002Felastic\u002Felastic-transport-php\u002Freleases\u002Ftag\u002Fv9.0.0) of elastic-transport-php.\n\nYou can have a look at the [BREAKING_CHANGES](BREAKING_CHANGES.md) file for more\ninformation.\n\n## Mock the Elasticsearch client\n\nIf you need to mock the Elasticsearch client you just need to mock a\n[PSR-18](https:\u002F\u002Fwww.php-fig.org\u002Fpsr\u002Fpsr-18\u002F) HTTP Client.\n\nFor instance, you can use the\n[php-http\u002Fmock-client](https:\u002F\u002Fgithub.com\u002Fphp-http\u002Fmock-client) as follows:\n\n```php\nuse Elastic\\Elasticsearch\\ClientBuilder;\nuse Elastic\\Elasticsearch\\Response\\Elasticsearch;\nuse Http\\Mock\\Client;\nuse Nyholm\\Psr7\\Response;\n\n$mock = new Client(); \u002F\u002F This is the mock client\n\n$client = ClientBuilder::create()\n    ->setHttpClient($mock)\n    ->build();\n\n\u002F\u002F This is a PSR-7 response\n$response = new Response(\n    200, \n    [Elasticsearch::HEADER_CHECK => Elasticsearch::PRODUCT_NAME],\n    'This is the body!'\n);\n$mock->addResponse($response);\n\n$result = $client->info(); \u002F\u002F Just calling an Elasticsearch endpoint\n\necho $result->asString(); \u002F\u002F This is the body!\n```\n\nWe are using the `ClientBuilder::setHttpClient()` to set the mock client.\nYou can specify the response that you want to have using the\n`addResponse($response)` function. As you can see the `$response` is a PSR-7\nresponse object. In this example we used the `Nyholm\\Psr7\\Response` object from\nthe [nyholm\u002Fpsr7](https:\u002F\u002Fgithub.com\u002FNyholm\u002Fpsr7) project. If you are using\n[PHPUnit](https:\u002F\u002Fphpunit.de\u002F) you can even mock the `ResponseInterface` as\nfollows:\n\n```php\n$response = $this->createMock('Psr\\Http\\Message\\ResponseInterface');\n```\n\n**Notice**: we added a special header in the HTTP response. This is the product\ncheck header, and it is required for guarantee that `elasticsearch-php` is\ncommunicating with an Elasticsearch server 8.0+.\n\nFor more information you can read the\n[Mock client](https:\u002F\u002Fdocs.php-http.org\u002Fen\u002Flatest\u002Fclients\u002Fmock-client.html)\nsection of PHP-HTTP documentation.\n\n## FAQ 🔮\n\n### Where do I report issues with the client?\n\nIf something is not working as expected, please open an\n[issue](https:\u002F\u002Fgithub.com\u002Felastic\u002Felasticsearch-php\u002Fissues\u002Fnew).\n\n### Where else can I go to get help?\n\nYou can checkout the\n[Elastic community discuss forums](https:\u002F\u002Fdiscuss.elastic.co\u002F).\n\n## Contribute 🚀\n\nWe welcome contributors to the project. You can refer to the [CONTRIBUTING](CONTRIBUTING.md)\nguide for more information.\n\nThanks in advance for your contribution! :heart:\n\n## License 📗\n\n[MIT](LICENSE) © [Elastic](https:\u002F\u002Fwww.elastic.co\u002F)\n","elastic\u002Felasticsearch-php 是 Elasticsearch 的官方 PHP 客户端。它提供了超过 500 个 API 端点，支持索引、搜索、删除等基本操作，能够帮助开发者在 PHP 应用中高效地与 Elasticsearch 进行交互。该客户端具备强大的功能和良好的扩展性，支持版本控制和向后兼容性变更管理，并且允许对客户端进行模拟测试。适用于需要在 PHP 项目中集成全文搜索、日志分析或数据聚合处理的场景。MIT 许可证下开源，拥有活跃的社区支持和详细的文档资源。",2,"2026-06-11 03:17:27","top_language"]