{"id":13579067,"url":"https://github.com/meilisearch/meilisearch-php","last_synced_at":"2025-05-13T21:11:02.131Z","repository":{"id":37453910,"uuid":"228859550","full_name":"meilisearch/meilisearch-php","owner":"meilisearch","description":"PHP wrapper for the Meilisearch API","archived":false,"fork":false,"pushed_at":"2025-04-28T12:54:56.000Z","size":1413,"stargazers_count":653,"open_issues_count":19,"forks_count":99,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-11T07:53:15.340Z","etag":null,"topics":["client","meilisearch","php","sdk"],"latest_commit_sha":null,"homepage":"https://meilisearch.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meilisearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-12-18T14:40:16.000Z","updated_at":"2025-05-11T05:17:03.000Z","dependencies_parsed_at":"2023-10-11T14:06:20.945Z","dependency_job_id":"a4bb8f9f-2be6-482c-a766-e09fff5dd012","html_url":"https://github.com/meilisearch/meilisearch-php","commit_stats":{"total_commits":605,"total_committers":60,"mean_commits":"10.083333333333334","dds":0.8115702479338843,"last_synced_commit":"7830fa2a41235234e962e3de6c149cac08459a33"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meilisearch%2Fmeilisearch-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meilisearch%2Fmeilisearch-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meilisearch%2Fmeilisearch-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meilisearch%2Fmeilisearch-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meilisearch","download_url":"https://codeload.github.com/meilisearch/meilisearch-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254029002,"owners_count":22002283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","meilisearch","php","sdk"],"created_at":"2024-08-01T15:01:36.245Z","updated_at":"2025-05-13T21:10:57.118Z","avatar_url":"https://github.com/meilisearch.png","language":"PHP","funding_links":[],"categories":["Embeddings \u0026 Vector Search","PHP","Integrations","Table of Contents"],"sub_categories":["Tokenizers \u0026 Prompt Utilities","Official Integrations","Globalization"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/meilisearch/integration-guides/main/assets/logos/meilisearch_php.svg\" alt=\"Meilisearch-PHP\" width=\"200\" height=\"200\" /\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eMeilisearch PHP\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\n  \u003ca href=\"https://github.com/meilisearch/meilisearch\"\u003eMeilisearch\u003c/a\u003e |\n  \u003ca href=\"https://www.meilisearch.com/cloud?utm_campaign=oss\u0026utm_source=github\u0026utm_medium=meilisearch-php\"\u003eMeilisearch Cloud\u003c/a\u003e |\n  \u003ca href=\"https://www.meilisearch.com/docs\"\u003eDocumentation\u003c/a\u003e |\n  \u003ca href=\"https://discord.meilisearch.com\"\u003eDiscord\u003c/a\u003e |\n  \u003ca href=\"https://roadmap.meilisearch.com/tabs/1-under-consideration\"\u003eRoadmap\u003c/a\u003e |\n  \u003ca href=\"https://www.meilisearch.com\"\u003eWebsite\u003c/a\u003e |\n  \u003ca href=\"https://www.meilisearch.com/docs/faq\"\u003eFAQ\u003c/a\u003e\n\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://codecov.io/gh/meilisearch/meilisearch-php/branch/main\"\u003e\u003cimg src=\"https://codecov.io/gh/meilisearch/meilisearch-php/branch/main/graph/badge.svg\" alt=\"Codecov coverage\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://packagist.org/packages/meilisearch/meilisearch-php\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/meilisearch/meilisearch-php\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/meilisearch/meilisearch-php/actions\"\u003e\u003cimg src=\"https://github.com/meilisearch/meilisearch-php/workflows/Tests/badge.svg\" alt=\"Test\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/meilisearch/meilisearch-php/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-informational\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://ms-bors.herokuapp.com/repositories/59\"\u003e\u003cimg src=\"https://bors.tech/images/badge_small.svg\" alt=\"Bors enabled\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e⚡ The Meilisearch API client written for PHP 🐘\u003c/p\u003e\n\n**Meilisearch PHP** is the Meilisearch API client for PHP developers.\n\n**Meilisearch** is an open-source search engine. [Learn more about Meilisearch.](https://github.com/meilisearch/Meilisearch)\n\n## Table of Contents \u003c!-- omit in TOC --\u003e\n\n- [📖 Documentation](#-documentation)\n- [🔧 Installation](#-installation)\n- [🚀 Getting started](#-getting-started)\n- [🤖 Compatibility with Meilisearch](#-compatibility-with-meilisearch)\n- [💡 Learn more](#-learn-more)\n- [🧰 HTTP Client Compatibilities](#-http-client-compatibilities)\n  - [Customize your HTTP Client](#customize-your-http-client)\n- [⚙️ Contributing](#️-contributing)\n\n## 📖 Documentation\n\n\nTo learn more about Meilisearch PHP, refer to the in-depth [Meilisearch PHP Documentation](https://php-sdk.meilisearch.com). To learn more about Meilisearch in general, refer to our [documentation](https://www.meilisearch.com/docs/learn/getting_started/quick_start) or our [API reference](https://www.meilisearch.com/docs/reference/api/overview).\n\n## 🔧 Installation\n\nTo get started, simply require the project using [Composer](https://getcomposer.org/).\u003cbr\u003e\nYou will also need to install packages that \"provide\" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation).\u003cbr\u003e\nA list with compatible HTTP clients and client adapters can be found at [php-http.org](http://docs.php-http.org/en/latest/clients.html).\n\n**If you don't know which HTTP client to use, we recommend using Guzzle 7**:\n\n```bash\ncomposer require meilisearch/meilisearch-php guzzlehttp/guzzle http-interop/http-factory-guzzle:^1.0\n```\n\nHere is an example of installation with the `symfony/http-client`:\n\n```bash\ncomposer require meilisearch/meilisearch-php symfony/http-client nyholm/psr7:^1.0\n```\n\n💡 *More HTTP client installations compatible with this package can be found [in this section](#-http-client-compatibilities).*\n\n### Run Meilisearch \u003c!-- omit in toc --\u003e\n\n⚡️ **Launch, scale, and streamline in minutes with Meilisearch Cloud**—no maintenance, no commitment, cancel anytime. [Try it free now](https://cloud.meilisearch.com/login?utm_campaign=oss\u0026utm_source=github\u0026utm_medium=meilisearch-php).\n\n🪨  Prefer to self-host? [Download and deploy](https://www.meilisearch.com/docs/learn/self_hosted/getting_started_with_self_hosted_meilisearch?utm_campaign=oss\u0026utm_source=github\u0026utm_medium=meilisearch-php) our fast, open-source search engine on your own infrastructure.\n\n## 🚀 Getting started\n\n#### Add documents \u003c!-- omit in toc --\u003e\n\n```php\n\u003c?php\n\nrequire_once __DIR__ . '/vendor/autoload.php';\n\nuse Meilisearch\\Client;\n\n$client = new Client('http://127.0.0.1:7700', 'masterKey');\n\n# An index is where the documents are stored.\n$index = $client-\u003eindex('movies');\n\n$documents = [\n    ['id' =\u003e 1,  'title' =\u003e 'Carol', 'genres' =\u003e ['Romance, Drama']],\n    ['id' =\u003e 2,  'title' =\u003e 'Wonder Woman', 'genres' =\u003e ['Action, Adventure']],\n    ['id' =\u003e 3,  'title' =\u003e 'Life of Pi', 'genres' =\u003e ['Adventure, Drama']],\n    ['id' =\u003e 4,  'title' =\u003e 'Mad Max: Fury Road', 'genres' =\u003e ['Adventure, Science Fiction']],\n    ['id' =\u003e 5,  'title' =\u003e 'Moana', 'genres' =\u003e ['Fantasy, Action']],\n    ['id' =\u003e 6,  'title' =\u003e 'Philadelphia', 'genres' =\u003e ['Drama']],\n];\n\n# If the index 'movies' does not exist, Meilisearch creates it when you first add the documents.\n$index-\u003eaddDocuments($documents); // =\u003e { \"uid\": 0 }\n```\n\nWith the `uid`, you can check the status (`enqueued`, `canceled`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://www.meilisearch.com/docs/reference/api/tasks#status).\n\n#### Basic Search \u003c!-- omit in toc --\u003e\n\n```php\n// Meilisearch is typo-tolerant:\n$hits = $index-\u003esearch('wondre woman')-\u003egetHits();\nprint_r($hits);\n```\n\nOutput:\n\n```php\nArray\n(\n    [0] =\u003e Array\n        (\n            [id] =\u003e 2\n            [title] =\u003e Wonder Woman\n            [genres] =\u003e Array\n                (\n                     [0] =\u003e Action, Adventure\n                )\n        )\n)\n```\n\n#### Custom Search \u003c!-- omit in toc --\u003e\n\nAll the supported options are described in the [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters) section of the documentation.\n\n💡 **More about the `search()` method in [the Wiki](https://github.com/meilisearch/meilisearch-php/wiki/Search).**\n\n```php\n$index-\u003esearch(\n    'phil',\n    [\n        'attributesToHighlight' =\u003e ['*'],\n    ]\n)-\u003egetRaw(); // Return in Array format\n```\n\nJSON output:\n\n```json\n{\n    \"hits\": [\n        {\n            \"id\": 6,\n            \"title\": \"Philadelphia\",\n            \"genre\": [\"Drama\"],\n            \"_formatted\": {\n                \"id\": 6,\n                \"title\": \"\u003cem\u003ePhil\u003c/em\u003eadelphia\",\n                \"genre\": [\"Drama\"]\n            }\n        }\n    ],\n    \"offset\": 0,\n    \"limit\": 20,\n    \"processingTimeMs\": 0,\n    \"query\": \"phil\"\n}\n```\n#### Custom Search With Filters \u003c!-- omit in toc --\u003e\n\nIf you want to enable filtering, you must add your attributes to the `filterableAttributes` index setting.\n\n```php\n$index-\u003eupdateFilterableAttributes([\n  'id',\n  'genres'\n]);\n```\n\nYou only need to perform this operation once.\n\nNote that Meilisearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [tasks](https://www.meilisearch.com/docs/reference/api/tasks#get-tasks)).\n\nThen, you can perform the search:\n\n```php\n$index-\u003esearch(\n  'wonder',\n  [\n    'filter' =\u003e ['id \u003e 1 AND genres = Action']\n  ]\n);\n```\n\n```json\n{\n  \"hits\": [\n    {\n      \"id\": 2,\n      \"title\": \"Wonder Woman\",\n      \"genres\": [\"Action\",\"Adventure\"]\n    }\n  ],\n  \"offset\": 0,\n  \"limit\": 20,\n  \"estimatedTotalHits\": 1,\n  \"processingTimeMs\": 0,\n  \"query\": \"wonder\"\n}\n```\n\n## 🤖 Compatibility with Meilisearch\n\nThis package guarantees compatibility with [version v1.x of Meilisearch](https://github.com/meilisearch/meilisearch/releases/latest), but some features may not be present. Please check the [issues](https://github.com/meilisearch/meilisearch-php/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aenhancement) for more info.\n\n## 💡 Learn more\n\nThe following sections in our main documentation website may interest you:\n\n- **Manipulate documents**: see the [API references](https://www.meilisearch.com/docs/reference/api/documents) or read more about [documents](https://www.meilisearch.com/docs/learn/core_concepts/documents).\n- **Search**: see the [API references](https://www.meilisearch.com/docs/reference/api/search) or follow our guide on [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters).\n- **Manage the indexes**: see the [API references](https://www.meilisearch.com/docs/reference/api/indexes) or read more about [indexes](https://www.meilisearch.com/docs/learn/core_concepts/indexes).\n- **Configure the index settings**: see the [API references](https://www.meilisearch.com/docs/reference/api/settings) or follow our guide on [settings parameters](https://www.meilisearch.com/docs/learn/configuration/settings).\n\n## 🧰 HTTP Client Compatibilities\n\nYou could use any [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible client to use with this SDK. No additional configurations are required.\u003cbr\u003e\nA list of compatible HTTP clients and client adapters can be found at [php-http.org](http://docs.php-http.org/en/latest/clients.html).\n\nIf you want to use this `meilisearch-php`:\n\n- with `guzzlehttp/guzzle` (Guzzle 7), run:\n\n```bash\ncomposer require meilisearch/meilisearch-php guzzlehttp/guzzle http-interop/http-factory-guzzle:^1.0\n```\n\n- with `php-http/guzzle6-adapter` (Guzzle \u003c 7), run:\n\n```bash\ncomposer require meilisearch/meilisearch-php php-http/guzzle6-adapter:^2.0 http-interop/http-factory-guzzle:^1.0\n```\n\n- with `symfony/http-client`, run:\n\n```bash\ncomposer require meilisearch/meilisearch-php symfony/http-client nyholm/psr7:^1.0\n```\n\n- with `php-http/curl-client`, run:\n\n```bash\ncomposer require meilisearch/meilisearch-php php-http/curl-client nyholm/psr7:^1.0\n```\n\n- with `kriswallsmith/buzz`, run:\n\n```bash\ncomposer require meilisearch/meilisearch-php kriswallsmith/buzz nyholm/psr7:^1.0\n```\n\n### Customize your HTTP Client\n\nFor some reason, you might want to pass a custom configuration to your own HTTP client.\u003cbr\u003e\nMake sure you have a [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible client when you initialize the Meilisearch client.\n\nFollowing the example in the [Getting started](#-getting-started) section, with the Guzzle HTTP client:\n\n```php\nnew Client('http://127.0.0.1:7700', 'masterKey', new GuzzleHttpClient(['timeout' =\u003e 2]));\n```\n\n## ⚙️ Contributing\n\nAny new contribution is more than welcome in this project!\n\nIf you want to know more about the development workflow or want to contribute, please visit our [contributing guidelines](/CONTRIBUTING.md) for detailed instructions!\n\n\u003chr\u003e\n\n**Meilisearch** provides and maintains many **SDKs and Integration tools** like this one. We want to provide everyone with an **amazing search experience for any kind of project**. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the [integration-guides](https://github.com/meilisearch/integration-guides) repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeilisearch%2Fmeilisearch-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeilisearch%2Fmeilisearch-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeilisearch%2Fmeilisearch-php/lists"}