Download the PHP package alexsaab/laravel-elasticsearch without Composer
On this page you can find all versions of the php package alexsaab/laravel-elasticsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alexsaab/laravel-elasticsearch
More information about alexsaab/laravel-elasticsearch
Files in alexsaab/laravel-elasticsearch
Package laravel-elasticsearch
Short Description An easy way to use the official PHP ElasticSearch client in your Laravel applications.
License MIT
Homepage https://github.com/cviebrock/laravel-elasticsearch
Informations about the package laravel-elasticsearch
Laravel-Elasticsearch
An easy way to use the official Elastic Search client in your Laravel or Lumen applications.
- Installation and Configuration
- Usage
- Advanced Usage
- Bugs, Suggestions, Contributions and Support
- Copyright and License
Installation and Configuration
Install the current version of the alexsaab/laravel-elasticsearch
package via composer:
If you are using ElasticSearch version 5, then install version 2 of this package:
Laravel
The package's service provider will automatically register its service provider.
Publish the configuration file:
Alternative configuration method via .env file
After you publish the configuration file as suggested above, you may configure ElasticSearch
by adding the following to your application's .env
file (with appropriate values):
Connecting to AWS Elasticsearch Service
If you are connecting to ElasticSearch instances on Amazon AWS, then you'll also
need to composer require aws/aws-sdk-php:^3.80
and add the following to your
.env
file:
Lumen
If you work with Lumen, please register the service provider and configuration in bootstrap/app.php
:
Manually copy the configuration file to your application.
Usage
The Elasticsearch
facade is just an entry point into the ES client,
so previously you might have used:
You can now replace those last two lines with simply:
That will run the command on the default connection. You can run a command on
any connection (see the defaultConnection
setting and connections
array in
the configuration file).
Lumen users who wish to use Facades can do so by editing the
bootstrap/app.php
file to include the following:
Lumen users who aren't using facades will need to use dependency injection or the application container in order to get the ES service object:
Of course, dependency injection and the application container work for Laravel applications as well.
Advanced Usage
Because the package is a wrapper around the official Elastic client, you can do pretty much anything with this package. Not only can you perform standard CRUD operations, but you can monitor the health of your Elastic cluster programmatically, back it up, or make changes to it. Some of these operations are done through "namespaced" commands, which this package happily supports.
To grab statistics for an index:
To create and restore snapshots (read the Elastic docs about creating repository paths and plugins first):
To delete whole indices (be careful!):
Please remember that this package is a thin wrapper around a large number of very sophisticated and well-documented Elastic features. Information about those features and the methods and parameters used to call them can be found in the Elastic documentation. Help with using them is available via the Elastic forums and on sites like Stack Overflow.
Bugs, Suggestions, Contributions and Support
Thanks to everyone who has contributed to this project!
Special thanks to JetBrains for their Open Source License Program ... and the excellent PHPStorm IDE, of course!
Please use Github for reporting bugs, and making comments or suggestions.
See CONTRIBUTING.md for how to contribute changes.
Copyright and License
laravel-elasticsearch was written by Colin Viebrock and is released under the MIT License.
Copyright (c) 2015 Colin Viebrock
All versions of laravel-elasticsearch with dependencies
elasticsearch/elasticsearch Version ^7.0
illuminate/support Version ~5.8.0|^6.0
illuminate/contracts Version ~5.8.0|^6.0