Looking to hire Laravel developers? Try LaraJobs

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
Links
Downloads
0

Comments
comments powered by Disqus

ElasticKit Laravel

Latest Version License

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 native LengthAwarePaginator.
  • Artisan commands for index management (index:create / delete / exists / mapping:put) and zero-downtime rebuild (with rollback / clean / unlock).
php artisan elastickit:rebuild posts
  • Eloquent sync via the EloquentSource trait — 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