elastickit-laravel maintained by ykan
Description
Laravel integration for ElasticKit: client bootstrapping and native pagination.
Author
Last update
2026/07/10 19:13
(dev-main)
License
Downloads
0
Tags
ElasticKit Laravel
Laravel integration for ElasticKit, the framework-agnostic Elasticsearch toolkit. It wires the Elasticsearch client from config, bridges ElasticKit's pagination to Laravel's paginator, exposes Artisan commands for index management and zero-downtime rebuilds, and syncs Eloquent models to Elasticsearch.
Requirements
PHP 8.1+, Laravel 10.x–12.x, Elasticsearch 8.x. ElasticKit is pulled in as a dependency.
Install
composer require ykan/elastickit-laravel
php artisan vendor:publish --tag=elastickit-config
Set cluster credentials in .env; the published config documents every option.
What it provides
- ES clients built from
config('elastickit.connections')— lazy, multi-cluster. - Pagination bridged to Laravel:
paginate()reads the request and returns a nativeLengthAwarePaginator. - Artisan commands for index management (
index:create/delete/exists/mapping:put) and zero-downtimerebuild(withrollback/clean/unlock).
php artisan elastickit:rebuild posts
- Eloquent sync via the
EloquentSourcetrait — attach it to an Index, declare a Model, and writes sync to Elasticsearch (queued, transaction-safe, source-driven).
use ElasticKit\Index\Index;
use ElasticKit\Laravel\EloquentSource;
class PostIndex extends Index
{
use EloquentSource;
protected string $name = 'posts';
protected string $model = Post::class;
}
License
MIT