Skip to content

Releases: meilisearch/meilisearch-php

v2.0.0-beta.6 🌱

v2.0.0-beta.6 🌱 Pre-release
Pre-release

Choose a tag to compare

@meili-bot meili-bot released this 28 Apr 09:21

Migration guide

If you're migrating from v1.x, read the complete migration guide.

API keys API now uses typed query and result objects

API key methods no longer accept array-based write payloads or return plain list shapes. They now use CreateKeyQuery and UpdateKeyQuery for requests, KeysResults for lists, and KeyAction for actions.

// Before (v1.x)
$key = $client->createKey([
    'description' => 'tenant token key',
    'actions'     => ['*'],
    'indexes'     => ['tenant*'],
    'expiresAt'   => '2055-10-02T00:00:00Z',
]);

// After (v2.x)
$key = $client->createKey(new CreateKeyQuery(
    actions:    [KeyAction::Any],
    indexes:    ['tenant*'],
    description: 'tenant token key',
    expiresAt:   new DateTimeImmutable('2055-10-02T00:00:00Z'),
));

The client updateKey method accepts an UpdateKeyQuery, which works similarly. It allows clearing the key name or description by passing null.

Additionally, KeysResults::count() was removed; use count($keysResults) instead.

Type improvements

  • SimilarDocumentsQuery, FacetSearchResult, and SearchResult are now final

🧪 Experimental features

⚠️ Breaking changes

  • Refactor Keys API to use typed query and result objects (#903) @norkunas

These other changes only pertain to PHPStan type hints improvements:

🚀 Enhancements

🐛 Bug Fixes

  • Use array_key_exists instead of isset in Task::offsetExists (#870) @norkunas
  • Fix uninitialized properties in TasksQueryTrait (#875) @norkunas

⚙️ Maintenance/misc

Thanks to @QDenka, @Strift, @curquiza, @mvanhorn and @norkunas! 🎉

See full changelog: v2.0.0-beta.5...v2.0.0-beta.6

v2.0.0-beta.5 🌱

v2.0.0-beta.5 🌱 Pre-release
Pre-release

Choose a tag to compare

@Strift Strift released this 04 Feb 02:19

Note

This replaces the incorrect v2.0.0-beta.4 release tagged from the wrong branch.

Migration guide

If you're migrating from v1.x, read the full migration guide instead.

🟠 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: v2.0.0-beta.3...v2.0.0-beta.5

v2.0.0-beta.4 🌱

v2.0.0-beta.4 🌱 Pre-release
Pre-release

Choose a tag to compare

@meili-bot meili-bot released this 03 Feb 08:30

Deprecated

Warning

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

v2.0.0-beta.3 🌱

v2.0.0-beta.3 🌱 Pre-release
Pre-release

Choose a tag to compare

@meili-bot meili-bot released this 23 Dec 10:14

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

Thanks to @Strift and @norkunas! 🎉

See full changelog: v2.0.0-beta.2...v2.0.0-beta.3

v2.0.0-beta.2 🌱

v2.0.0-beta.2 🌱 Pre-release
Pre-release

Choose a tag to compare

@Strift Strift released this 11 Dec 06:45

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

🐛 Bug Fixes

⚙️ Maintenance/misc

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

See full changelog: v2.0.0-beta.1...v2.0.0-beta.2

v2.0.0-beta.1 🌱

v2.0.0-beta.1 🌱 Pre-release
Pre-release

Choose a tag to compare

@Strift Strift released this 18 Nov 10:56

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

🚀 Enhancements

🐛 Bug Fixes

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

⚙️ Maintenance/misc

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

See full changelog: v1.16.0...v2.0.0-beta.1

v1.16.1 🚀

Choose a tag to compare

@meili-bot meili-bot released this 18 Sep 10:25

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

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

See full changelog: v1.16.0...v1.16.1

v1.16.0 🐘

Choose a tag to compare

@meili-bot meili-bot released this 10 Sep 08:54
04f7e54

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

🚀 Enhancements

🐛 Bug Fixes

⚙️ Maintenance/misc

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

v1.15.0 🦘

Choose a tag to compare

@meili-bot meili-bot released this 10 Jun 04:38
94930b9

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

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

v1.14.0 🐘

Choose a tag to compare

@meili-bot meili-bot released this 14 Apr 12:37
860c6f8

🚀 Enhancements

Thanks again to @Strift! 🎉