limenet / laravel-elastica-bridge
A simple bridge between Laravel and Elasticsearch using Elastica
v1.9.0
2024-03-17 11:22 UTC
Requires
- php: ^8.1
- laravel/framework: ^10.0 || ^11.0
- ruflin/elastica: ^7.1 || 8.x-dev
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- driftingly/rector-laravel: ^1.0
- larastan/larastan: ^2.9.2
- laravel/pint: ^1.14.0
- nunomaduro/collision: ^7.10.0 || ^8.1.1
- orchestra/testbench: ^8.22.0 || ^9.0
- phpstan/extension-installer: ^1.3.1
- phpstan/phpstan-deprecation-rules: ^1.1.4
- phpstan/phpstan-phpunit: ^1.3.16
- phpstan/phpstan-strict-rules: ^1.5.2
- phpunit/phpunit: ^10.5.13
- psr/log: ^3.0
- rector/rector: ^1.0.3
- sentry/sentry: ^4.6.1
- symfony/http-client: ^6.4.5
README
A simple bridge between Laravel and Elasticsearch using Elastica, based on https://github.com/valantic/pimcore-elastica-bridge.
Requirements
- PHP 8.1+
- Laravel 10.0
- Job Batching is setup
Installation
You can install the package via composer:
composer require limenet/laravel-elastica-bridge
You can publish and run the migrations with:
php artisan vendor:publish --provider="Limenet\LaravelElasticaBridge\LaravelElasticaBridgeServiceProvider" --tag="elastica-bridge-migrations" php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="Limenet\LaravelElasticaBridge\LaravelElasticaBridgeServiceProvider" --tag="elastica-bridge-config"
This is the contents of the published config file:
return [ 'elasticsearch' => [ 'host' => env('ELASTICSEARCH_HOST', 'localhost'), 'port' => env('ELASTICSEARCH_PORT', '9200'), ], 'indices' => [], 'events' => [ 'listen' => true, ], ];
Usage
- Add
Limenet\LaravelElasticaBridge\Model\ElasticsearchableInterface
andLimenet\LaravelElasticaBridge\Model\ElasticsearchableTrait
to a model - Create a class extending
Limenet\LaravelElasticaBridge\Index\AbstractIndex
- Add the index to your config (
elastica-bridge.indices
) - Run
php artisan elastica-bridge:index
- Check using
php artisan elastica-bridge:status
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.