Download the PHP package gnahotelsolutions/laravel-elasticsearch without Composer

On this page you can find all versions of the php package gnahotelsolutions/laravel-elasticsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-elasticsearch

Laravel-Elasticsearch

An easy way to use the official Elastic Search client in your Laravel or Lumen applications.

⚠️ This Package Will Be Abandoned

Due to several factors, including the fact that I no longer use ES, I will be ceasing development on this package. If you are interested in taking over this project, please reach out to me here or on Twitter: @cviebrock

Build Status Total Downloads Latest Stable Version Latest Stable Version

Installation and Configuration

Install the current version of the cviebrock/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:

If you have to use another authentication method having custom credentials (i.e. instanceProfile()), you have to publish the configuration file and use the aws_credentials:

If you have a job that runs in supervisor, you have to use the Closure. This way the credentials will be renewed at runtime.

If you are using php artisan config:cache, you cannot have the Closure in your config file, call it like this:

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.

Console commands

This package also provides some useful console commands.

Check if an index exists:

Create an index:

Delete an index:

Create or update index mapping:
Note: The index mapping file must contain a valid JSON mapping definition as Elasticsearch expects, for example:

Creates an alias:

Remove index from an alias:

Switch index on alias (useful for zero-downtime release of the new index):

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

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0|^8.1
ext-json Version *
elasticsearch/elasticsearch Version ^7.11
guzzlehttp/psr7 Version ^2.0
illuminate/contracts Version ^8.0|^9.0|^10
illuminate/support Version ^8.0|^9.0|^10
psr/http-message Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gnahotelsolutions/laravel-elasticsearch contains the following files

Loading the files please wait ....