ss-wiking / elastic-orm
Elasticsearch ORM like Eloquent
v0.3.2-alpha.3
2022-03-30 09:24 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- barryvdh/reflection-docblock: ^2.0
- elasticsearch/elasticsearch: ^7.17
- illuminate/support: ^8.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-03-19 23:38:05 UTC
README
High level Elasticsearch ORM for Laravel with query builder and models
Installation
You can install the package via composer:
composer require ss-wiking/elastic-orm
Usage
Model
use SsWiking\ElasticOrm\Model; class Product extends Model { /** * Model index name * If not provided, it will be got from model name in plural form * * @var string */ protected string $index = 'products'; }
Query Builder via Model
$products = Product::whereIn('id', $ids) ->whereGreaterThan('price', $minPrice) ->get();
Query Builder via Facade
use SsWiking\ElasticOrm\Facades\ElasticOrm; ElasticOrm::index('goods')->limit(10)->offset(10)->get();
Publishing config
php artisan vendor:publish --provider="SsWiking\ElasticOrm\Providers\ElasticOrmServiceProvider" --tag=config
Generate model's meta
php artisan elastic-orm:meta "App\Models\Elastic\YourModelName"
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email ss.wiking@outlook.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.