hedeqiang / elasticsearch
ElasticSearch service provider for Laravel.
v1.0.2
2022-11-22 03:58 UTC
Requires
- elasticsearch/elasticsearch: ~7.0
- laravel/framework: ~5.5|~5.8|~6.0|~7.0|~8.0|~9.0
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.7
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ^1.2
- orchestra/testbench: ^3.7
- phpunit/phpunit: ~8.0
README
ElasticSearch service provider for Laravel.
安装
$ composer require hedeqiang/elasticsearch -vvv
配置
config/database.php
添加如下代码:
. . . 'elasticsearch' => [ [ 'host' => env('ES_HOST','localhost'), 'port' => env('ES_PORT','9200'), 'scheme' => env('ES_SCHEME','http'), 'user' => env('ES_USERNAME',null), 'pass' => env('ES_PASSWORD','null'), ], ],
.env
配置文件
ES_HOST=localhost
ES_PORT=9200
ES_SCHEME=http
ES_USERNAME=
ES_PASSWORD=
使用
服务名使用
return app('es')->info();
Facades 门面使用
use Hedeqiang\ElasticSearch\Facades\Elastic; return Elastic::es()->info();
TODO
License
MIT