Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Meilisearch Php Laravel Package

meilisearch/meilisearch-php

Official Meilisearch PHP SDK: a fast, easy API client to index documents, manage settings, and run searches with Meilisearch or Meilisearch Cloud. Supports popular HTTP clients and customizable transport.

View on GitHub
Deep Wiki
Context7
v2.0.0-beta.5

[!NOTE] This replaces the incorrect v2.0.0-beta.4 release tagged from the wrong branch.

Migration guide

🟠 Task methods now return types (Impact: moderate)

$client->getTasks() and $index->getTasks() now return a TaskResults object.

// Before (v1.x)
$tasks = $client->getTasks();
$results = $tasks['results']; // Accessing as array

// After (v2.x)
$tasks = $client->getTasks(); // Returns TaskResults
$results = $tasks->getResults(); // Returns an array of Task objects

Additionally

  • The internal task manager all() method now returns an array of Task objects.
  • The TaskResults class is now final

⚠️ Breaking changes

  • Wrap data with Task before passing to TasksResults (#864) @norkunas

🚀 Enhancements

  • Add raw data to Task and implement ArrayAccess (backward compatibility) (#863) @norkunas
  • Use environment flag to allow all network IPs in tests (#867) @Strift

⚙️ Maintenance/misc

Thanks to @Strift, @norkunas and dependabot[bot]! 🎉

See full changelog: https://github.com/meilisearch/meilisearch-php/compare/v2.0.0-beta.3...v2.0.0-beta.5

v2.0.0-beta.4

Deprecated

[!WARNING] This release was incorrectly tagged from the wrong branch.
Please use v2.0.0-beta.5 instead.

v2.0.0-beta.3

Migration guide

🟢 Improved exception types DX (Impact: minor)

The custom $message property has been removed from custom exceptions. Use the getMessage() method instead:

try {
    // ...
} catch (\Meilisearch\Exceptions\ApiException $e) {
   // Before (v1.x)
    echo $e->message;
    // After (v2.x)
    echo $e->getMessage();
}

Also:

  • Exception classes are now final
  • Exception public properties are now read-only and strictly typed.
  • The rethrowWithHint static method now returns a \RuntimeException instead of a generic \Exception.

⚠️ Breaking changes

🚀 Enhancements

  • Update experimental Network API for Meilisearch v1.30 compatibility (#853) @Strift

⚙️ Maintenance/misc

  • Fix PHP-CS-Fixer deprecation (#830) @norkunas

Thanks to @Strift and @norkunas! 🎉

See full changelog: https://github.com/meilisearch/meilisearch-php/compare/v2.0.0-beta.2...v2.0.0-beta.3

v2.0.0-beta.2

Migration guide

Database stats now return a typed Stats object

$stats = $client->stats();

// Before (v1.x) - accessing stats as array
$databaseSize = $response['databaseSize'];
$usedDatabaseSize = $response['usedDatabaseSize'];
// etc...

// After (v2.x) - use getter methods
$databaseSize = $stats->getDatabaseSize();
$usedDatabaseSize = $stats->getUsedDatabaseSize();

Version is now a typed Version object

$version = $client->version();

// Before (v1.x) - access as array
$commitSha = $version['commitSha'];
$commitDate = $version['commitDate']; // String
$pkgVersion = $version['pkgVersion'];

// After (v2.x) - use getter methods
$commitSha = $version->getCommitSha();
$commitDate = $version->getCommitDate(); // \DateTimeImmutable
$pkgVersion = $version->getPkgVersion();

Removed legacy MeiliSearch namespace

We removed MeiliSearch (capital S) namespace.

// Before (v1.x) - MeiliSearch with capital S
use MeiliSearch\Client;

// After (v2.x) - Meilisearch without capital S
use Meilisearch\Client;

Removed Indexes::parseDate() public method

This only affects you if you were using this utility method directly.

// Before (v1.x) - If you used this method in your code
$dateTime = \Meilisearch\Endpoints\Indexes::parseDate('2021-01-01T01:23:45.123456Z');

// After (v2.x) - Use native PHP instead
$dateTime = new \DateTimeImmutable('2021-01-01T01:23:45.123456Z');

⚠️ Breaking changes

  • Remove custom date parsing (#826) @norkunas
  • Add typed Stats object (#823) @norkunas
  • Remove remaining custom datetime parsing (#827) @norkunas
  • Add typed Version object (#821) @norkunas
  • Remove legacy namespace (#822) @norkunas

🐛 Bug Fixes

  • Fix: expose facetStats in SearchResult::toArray (#828) @walkwizus

⚙️ Maintenance/misc

  • Add PHP 8.5 to CI (#829) @norkunas
  • allow symfony/http-client 8.0 (#820) @tacman
  • Fix test namespaces (#824) @norkunas
  • Add PHP 8.5 to CI (#829) @norkunas
  • chore: handle unknown commit date in version (#836) @Strift
  • Use Meilisearch Enterprise Edition (#835) @Strift

Thanks to @Strift, @bpolaszek, @dependabot[bot], @norkunas, @tacman, and @walkwizus! 🎉

See full changelog: https://github.com/meilisearch/meilisearch-php/compare/v2.0.0-beta.1...v2.0.0-beta.2

v2.0.0-beta.1

While we recommend against production usage due to breaking changes, the code is stable. Please consider whether you can afford the potential upcoming breaking changes before upgrading.

Migration guide

Refactor tasks as objects, and task status and type as enums

This introduces two changes:

  • Asynchronous operations now return Tasks as an object instead of an array
  • Tasks can be awaited with the new wait(int $timeoutInMs = 5000, int $intervalInMs = 50): Task method

Awaiting tasks:

// Before
$promise = $this->client->createIndex('new-index', ['primaryKey' => 'objectID']);
$this->index->waitForTask($promise['taskUid']);

// After
$this->client->createIndex('new-index', ['primaryKey' => 'objectID'])->wait();

Asserting task status:

// Before
$task = $this->client->getTask($taskUid);
if ($task['status'] === 'succeeded') {
    // do something
}

// After
if ($task->getStatus() === TaskStatus::Succeeded) {
    // do something
}

Asserting task types:

// Before
$task = $this->client->getTask($taskUid);
if ($task['type'] === 'indexCreation') {
    // do something
}

// After
$task = $this->client->getTask($taskUid);
if ($task->getType() === TaskType::IndexCreation) {
    // do something
}

Remove custom exception for JSON parsing

Before: catching SDK-specific JSON exceptions

<?php

try {
    $client->index('books')->addDocuments([["title" => "\xB1\x31"]]);
} catch (JsonEncodingException | JsonDecodingException $e) {
    // handle JSON errors
}

After: catching native PHP JsonException

<?php

try {
    $client->index('books')->addDocuments([["title" => "\xB1\x31"]]);
} catch (\JsonException $e) {
    // handle JSON errors
}

⚠️ Breaking changes

  • feat: remove custom json exceptions (#791) @Strift
  • Bump to PHP 8.1, improve type safety for Tasks (#735) @norkunas

🚀 Enhancements

  • Support sort for documents endpoint (#779) @bpolaszek

🐛 Bug Fixes

  • Cast federation payload explicitly to an object (#757) @norkunas

⚙️ Maintenance/misc

  • Update repository config for v2 (#787) @Strift
  • fix: reference the correct php-version in matrix (#792) @Strift
  • chore: update ci for v2 (#793) @Strift
  • chore: update release drafter (#804) @Strift
  • Update dependabot and release template configuration (#806)
  • Migrate CI from bors to merge queue (#801) @Strift
  • Bump actions/upload-artifact from 4 to 5 (#813) @dependabot[bot]
  • Bump actions/download-artifact from 4 to 6 (#812) @dependabot[bot]

Thanks to @Strift, @bpolaszek, and @norkunas! 🎉

See full changelog: https://github.com/meilisearch/meilisearch-php/compare/v1.16.0...v2.0.0-beta.1

v1.16.1

What's Changed

This PR adds support for sorting to the documents endpoint.

🚀 Enhancements

  • chore: backport document sorting to v1.x (#802) @Strift

🐛 Bug Fixes

  • chore: backport federated search fix (#789) @Strift

Thanks to @Strift, and dependabot[bot]! 🎉

See full changelog: https://github.com/meilisearch/meilisearch-php/compare/v1.16.0...v1.16.1

v1.16.0

This release makes the SDK compatible with features release in Meilisearch 1.16.

🚀 Enhancements

  • Run tests only with a single http client (#758) @norkunas
  • Add conversational search (#774) @Strift
  • Add multi-modal search (#783) @Strift

🐛 Bug Fixes

  • fix: wrong type for retrieveVectors (#777) @bpolaszek

⚙️ Maintenance/misc

  • Run tests only with a single http client (#758) @norkunas
  • Fix index swaps tests after v1.18 (#780) @Strift
  • Make network tests compatible with v1.19 (#781) @Strift
  • tests: increase PHP memory limit to 512M in Dockerfile (#778) @bpolaszek
  • Make network tests compatible with v1.19 (#781) @Strift

Thanks again to @Strift, @bpolaszek, @brunoocasali, and @norkunas! 🎉

v1.15.0

This version introduces features released in Meilisearch v1.15.0.

🚀 Enhancements

  • Add disableOnNumbers field to typo tolerance settings (#753) @Strift
  • Add remote federated search (#738) @Strift
  • Pass HTTP headers without mutating HTTP client instance (#755) @norkunas

⚙️ Maintenance/misc

  • Remove _md code samples for Mintlify migration (#737) @curquiza
  • Improve distinct attribute search tests (#754) @Strift
  • Add more phpstan extensions (#756) @norkunas

Thanks again to @Strift, @curquiza, and @norkunas! 🎉

v1.14.0

🚀 Enhancements

Thanks again to @Strift! 🎉

v1.13.0

This version introduces features released on Meilisearch v1.13.0 🎉 Check out the changelog of Meilisearch v1.13.0 for more information on the changes.

✨ New

⚙️ Maintenance/misc

  • Fix flaky tasks reverse test (#710) @Strift

Thanks again to @Strift! 🎉

v1.12.0

This version introduces features released on Meilisearch v1.12.0 🎉

Check out the Meilisearch v1.12.0 changelog for more information.

🚀 Enhancements

  • Addition: #699

Introducing new methods to get one or several batches, respectively getBatch() and getBatches(). A batch is a set of tasks processed together.

  • Addition: #698

The TaskQuery class now has a setReverse() method to retrieve tasks in reverse chronological order.

client->getTasks((new TasksQuery())->setReverse(true));
  • Addition: #702

Index settings now allow disabling prefix search and facet search. They're both enabled by default. The SDK now comes with dedicated methods to configure these settings.

// disable prefix search
$index->updatePrefixSearch('disabled');
// reset prefix search settings
$index->resetPrefixSearch();

// disable facet search
$index->updateFacetSearch(false);
// reset facet search settings
$index->resetFacetSearch();

🐛 Bug Fixes

⚙️ Maintenance/misc

Thanks again to @aivchen, @johnnynotsolucky, @norkunas, @mdubus and @Strift! 🎉

v1.11.0

This version introduces features released on Meilisearch v1.11.0 🎉 Check out the changelog of Meilisearch v1.11.0 for more information on the changes.

⚠️ Breaking change (experimental feature only)

🚀 Enhancements

  • Add facet distribution to multiSearch (#683) @ManyTheFish & @norkunas
  • Add rankingScoreThreshold to SimilarDocumentsQuery (#675) @norkunas
  • feat: Adds hybrid search options contract for multisearch (#677) @apozeus
  • Cast body to a string to force rewind of stream (#678) @grizzm0

⚙️ Maintenance/misc

  • Improve coding standards (#684, #674, #673) @norkunas

Thanks again to @ManyTheFish, @grizzm0, @apozeus and @norkunas! 🎉

v1.10.1

🚀 Enhancements

  • feat: Adds hybrid search options contract for multisearch (#677) @apozeus
  • Cast body to a string to force rewind of stream (#678) @grizzm0
  • Add rankingScoreThreshold to SimilarDocumentsQuery (#675) @norkunas

⚙️ Maintenance/misc

Thanks again to @apozeus, @grizzm0, and @norkunas! 🎉

v1.10.0

🚀 Enhancements

  • Implements localized attributes (#662) @irevoire
  • Handle the new federation options (#663) @irevoire
  • Implements the update documents by function (#664) @irevoire

⚙️ Maintenance/misc

Thanks again to @brunoocasali, @curquiza, @irevoire, and @norkunas! 🎉

v1.9.1

🐛 Bug Fixes

  • Handle unexpected but valid JSON content-types (#656) @brunoocasali

⚙️ Maintenance/misc

Thanks again to @brunoocasali, and @norkunas! 🎉

v1.9.0

This version introduces features released on Meilisearch v1.9.0 🎉 Check out the changelog of Meilisearch v1.9.0 for more information on the changes.

🚀 Enhancements

$client->index('INDEX_NAME')->search('badman', [
  'rankingScoreThreshold' => 0.2
]);
$similarQuery = new SimilarDocumentsQuery('TARGET_DOCUMENT_ID');
$client->index('INDEX_NAME')->getSimilar($similarQuery);
  • hybrid search changes (#649) @ManyTheFish
    • Add setRetrieveVectors method to SimilarDocumentsQuery
    • Add setRetrieveVectors method to DocumentsQuery
  • Add distinct attribute at search (#648) @the-sinner
$client->index('products')->updateFilterableAttributes(['product_id', 'sku', 'url']);

⚙️ Maintenance/misc

Thanks again to @Koopzington, @ManyTheFish, @curquiza, and @the-sinner! 🎉

v1.8.0

This version introduces features released on Meilisearch v1.8.0 🎉 Check out the changelog of Meilisearch v1.8.0 for more information on the changes.

🚀 Enhancements

$client->index('books')->getSearchCutoffMs();
$client->index('books')->updateSearchCutoffMs(150);
$client->index('books')->resetSearchCutoffMs();

⚙️ Maintenance/misc

Thanks again to @brunoocasali, @curquiza, @guimachiavelli, and @norkunas! 🎉

v1.7.0

This version introduces features released on Meilisearch v1.7.0 :tada: Check out the changelog of Meilisearch v1.7.0 for more information on the changes.

⚠️ Breaking changes

  • scoreDetails feature is not experimental anymore. You can directly use showRankingScoreDetails during a search without activating the experimental feature 🎉

🚀 Enhancements

  • Includes any changes related to Hybrid search introduced in Meilisearch v1.7.0 🎉

⚙️ Maintenance/misc

  • Added CodeCov coverage report support (#616) @connorhu
v1.6.1

🐛 Bug Fixes

  • Fix "CsvInBatchesWithDelimiter" test (#613) @aivchen

⚙️ Maintenance/misc

  • Use proper typehint for proximityPrecision (#610) @norkunas
  • Fix "dynamic call to static method" phpstan error in tests (#612) @aivchen
  • Fix CS (#618) @norkunas

Thanks again to @aivchen, and @norkunas! 🎉

v1.6.0

🚀 Enhancements

$client->index('books')->getProximityPrecision();
$client->index('books')->updateProximityPrecision('byAttribute');
$client->index('books')->resetProximityPrecision();

🧪 Experimental enhancement - Hybrid and vector search

⚠️ This is about an experimental feature of Meilisearch. Activate the vectorStore experimental feature to use it

$client->index('books')->getEmbedders();
$client->index('books')->updateEmbedders(['default' => ['source' => 'userProvided', 'dimensions' => 1]]);
$client->index('books')->resetEmbedders();

⚙️ Maintenance/misc

  • Declare [@throws](https://github.com/throws) in HandlesTasks delegate (#599) @norkunas

Thanks again to @norkunas, @brunoocasali! 🎉

v1.5.0

This version introduces features released on Meilisearch v1.5.0 :tada: Check out the changelog of Meilisearch v1.5.0 for more information on the changes.

⚠️ If you want to adopt new features of this release, update the Meilisearch server to the appropriate version.

🚀 Enhancements

  • Needs Meilisearch v1.5.0 -> Add new method createSnapshot() to trigger snapshot creation. Similar to the already existing createDump() for dumps (#587) @brunoocasali

⚙️ Maintenance/misc

  • Add CI to update library version (#589) @curquiza
v1.4.1

🐛 Bug Fixes

  • Fix an unexpected breaking change in v1.4.0 when passing a empty masterkey (#585) @mmachatschek

Thanks again to @mmachatschek! 🎉

v1.4.0

This version introduces features released on Meilisearch v1.4.0 :tada: Check out the changelog of Meilisearch v1.4.0 for more information on the changes.

⚠️ If you want to adopt new features of this release, update the Meilisearch server to the according version.

🚀 Enhancements

  • Needs Meilisearch v1.4.0 -> Add support for the new setting: dictionary (#574) @alallema
$index->getDictionary();
$index->updateDictionary(['J. R. R.', 'W. E. B.']);
$index->resetDictionary();
  • Needs Meilisearch v1.4.0 -> Add support for the new setting: separator-tokens (#574) @alallema
$index->getSeparatorTokens();
$index->updateSeparatorTokens(['|', '&hellip;']);
$index->resetSeparatorTokens();
  • Needs Meilisearch v1.4.0 -> Add support for the new setting: non-separator-tokens (#574) @alallema
$index->getNonSeparatorTokens();
$index->updateNonSeparatorTokens(['@', '#']);
$index->resetNonSeparatorTokens();

⚠️ Warning usage with v1.4.0

A bug fix in Meilisearch v1.4.0 introduces a breaking change in the filter usage. It only concerns users using the filter search parameter with \. Explanation and change to apply are detailed in the Meilisearch v1.4.0

Thanks again to @alallema, @brunoocasali, @curquiza, @dependabot, @dependabot[bot], @meili-bors[bot], and @norkunas! 🎉

v1.3.0

This version introduces features released on Meilisearch v1.3.0 :tada: Check out the changelog of Meilisearch v1.3.0 for more information on the changes.

⚠️ If you want to adopt new features of this release, update the Meilisearch server to the according version.

🚀 Enhancements

  • Add a base exception interface all exceptions must implement (#534) @94noni
  • ⚠️ EXPERIMENTAL: setShowRankingScoreDetails and search(['showRankingScoreDetails' => boolean]) to show the scores of each relevant document returned in the search.
  • ⚠️ EXPERIMENTAL: setVector and search(['vector' => [...]]) to enable vector search capabilities.
  • Add setAttributesToSearchOn and search(['attributesToSearchOn' => [...]])
  • index->facetSearch(FacetSearchQuery params) to search only in facets.

⚠️ The EXPERIMENTAL features are not covered by semver. To explicitly opt-in, check this guide.

💅 Misc

  • Migrate docs hosting to Meilisearch subdomain (#553) @Strift
  • Update SDK docs link in README.md (#556) @Strift
  • [DX] Improve quality of Client class & related (#514) @stloyd
  • [DX] Add support for PHPUnit 10.1 (#516) @stloyd

Thanks again to @94noni, @Strift, @alallema, @brunoocasali, @norkunas and @stloyd! 🎉

v1.2.1

🐛 Bug Fixes

  • Fix fetching documents by getDocuments with filters and fields being set in DocumentsQuery (#523) @panzer-punk
  • Remove duplicated key on code-samples (#520) @justkahdri

Thanks again to @justkahdri, @panzer-punk! 🎉

v1.2.0

This version introduces features released on Meilisearch v1.2.0 :tada: Check out the changelog of Meilisearch v1.2.0 for more information on the changes. ⚠️ If you want to adopt new features of this release, update the Meilisearch server to the according version.

:rocket: Enhancements

  • The method deleteDocuments() now supports a different behavior. This method could take an array containing a filter key with the filter value, which will filter and delete the documents. #509 @brunoocasali

    ⚠️ You must configure the attributes you want to filter using the Index\filterableAttributes(). ⚠️ Remember to update your Meilisearch server to v1.2.0 or newer before adopting it.

    Still, even being supported, the ability to receive only a list of ids is deprecated, and it will be removed in meilisearch-php v2

  • Add the ability to setFilter in the DocumentsQuery. When a query with a filter is sent to getDocuments(DocumentsQuery $query) it will filter the documents similar to the search method. See the docs on how to use filters. #510 @brunoocasali

    ⚠️ You must configure the attributes you want to filter using the Index\filterableAttributes(). ⚠️ Remember to update your Meilisearch server to v1.2.0 or newer before adopting it.

Thanks again to @brunoocasali, @tacman, @norkunas! 🎉

v1.1.0

This version introduces features released on Meilisearch v1.1.0 :tada: Check out the changelog of Meilisearch v1.1.0 for more information on the changes. If you want to adopt new features of this release, update the Meilisearch server to the according version.

:rocket: Enhancements

  • Add a new optional argument to addDocumentsCsv, addDocumentsCsvInBatches, and updateDocumentsCsvInBatches. This argument allows you to customize the separator character in your csv file. (#480) @brunoocasali
  • Add a new getter, the facetStats on SearchResult (#487) @brunoocasali.
  • Add $client->multiSearch() method to execute multiple search requests simultaneously with different configurations. (#481) @brunoocasali
    • Introduce SearchQuery builder class to build the search requests used in the multiSearch. Usage example:

      $this->client->multiSearch([
        (new SearchQuery())->setIndexUid('books')
            ->setQuery('princ')
            ->setSort(['author:desc']),
        (new SearchQuery())->setIndexUid('movies')
            ->setQuery('be')
            ->setHitsPerPage(4)
            ->setFilter(['duration-float > 3']),
      ]);
      
    :warning: The SearchQuery was not meant to be used if the regular $index->search() requests (yet).
v1.0.0

This version makes this package compatible with Meilisearch v1.0.0 :tada: Check out the changelog of Meilisearch v1.0.0 for more information on the changes.

💥 Breaking Changes

  • Endpoints/Indexes date attributes $createdAt and $updatedAt are DateTime now instead of string. (#457) @brunoocasali
    • Removed getCreatedAtString and getUpdatedAtString functions.
  • Add canceledBy/setCanceledBy in TasksQuery (#454) @brunoocasali
  • Remove next attribute and setNext from TasksQuery. (#454) @brunoocasali
  • Remove next attribute and setNext from DeleteTasksQuery. (#454) @brunoocasali
  • Remove next, canceledBy attributes and setNext, setCanceledBy from CancelTasksQuery. (#454) @brunoocasali
  • Remove deleteAllIndexes, since they don't really delete all the indexes but only the first page. (#454) @brunoocasali
  • Remove getAllRawIndexes function. (#454) @brunoocasali
  • Rename getAllIndexes to getIndexes. (#454) @brunoocasali
  • Move all traits to src/Endpoints/Delegates. (#455) @brunoocasali
    • Meilisearch\Delegates\HandlesIndex to Meilisearch\Endpoints\Delegates\HandlesIndex
    • Meilisearch\Delegates\HandlesSystem to Meilisearch\Endpoints\Delegates\HandlesSystem
    • Meilisearch\Delegates\TasksQueryTrait to Meilisearch\Endpoints\Delegates\TasksQueryTrait

Enhancements

Thanks again to @brunoocasali and @norkunas! 🎉

v0.27.0

⚠️ This release has nothing new, and it is just a tag to mark the previous release v0.26.1 as breaking, so v0.27.0.

You should be careful because every occurrence of MeiliSearch, even in the file names were changed to Meilisearch.

More details in the comments section here and here.


Original changelog from v0.26.1:

🚀 Enhancements

  • Change casing of MeiliSearch to Meilisearch (#431) @mmachatschek

⚠️ If you handle ::class directly, a change is required, as pointed out https://github.com/meilisearch/meilisearch-php/pull/431#issuecomment-1365760201

Thanks again to @brunoocasali and @mmachatschek! 🎉

v0.26.1

🚀 Enhancements

  • Change casing of MeiliSearch to Meilisearch (#431) @mmachatschek

⚠️ If you handle ::class directly, a change is required, as pointed out https://github.com/meilisearch/meilisearch-php/pull/431#issuecomment-1365760201

Thanks again to @brunoocasali and @mmachatschek! 🎉

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport