packagist meilisearch/meilisearch-php v2.0.0-beta.6
v2.0.0-beta.6 ๐ŸŒฑ

6 hours ago

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

Don't miss a new meilisearch-php release

NewReleases is sending notifications on new releases.