Download the PHP package designmynight/laravel-elasticsearch without Composer

On this page you can find all versions of the php package designmynight/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

Use Elasticsearch as a database in Laravel to retrieve Eloquent models and perform aggregations.

Build Elasticsearch queries as you're used to with Eloquent, and get Model instances in return, with some nice extras:

Versions

Depending on your version of Elasticsearch you can use the following version of this package

Elasticsearch Laravel Elasticsearch
>= 7.0, < 7.1 6
>= 6.6, < 7.0 5
>= 5.0, < 6.0 4

Setup

Add elasticsearch connection configuration to database.php

Create or update your base Model.php class to override newEloquentBuilder() and newBaseQueryBuilder():

Search

You're now ready to carry out searches on your data. The query will look for an Elasticsearch index with the same name as the database table that your models reside in.

Aggregations

Aggregations can be added to a query with an approach that's similar to querying Elasticsearch directly, using nested functions rather than nested arrays. The aggregation() method takes three or four arguments:

  1. A key to be used for the aggregation
  2. The type of aggregation, such as 'filter' or 'terms'
  3. (Optional) A callback or array providing options for the aggregation
  4. (Optional) A function allowing you to provide further sub-aggregations

Geo queries

You can filter search results by distance from a geo point or include only those results that fall within given bounds, passing arguments in the format you'd use if querying Elasticsearch directly.

Scroll API

You can use a scroll search to retrieve large numbers of results. Rather than returning a Collection, you'll get a PHP Generator function that you can iterate over, where each value is a Model for a single result from Elasticsearch.

Console

This package ships with the following commands to be used as utilities or as part of your deployment process.

Command Arguments Options Description
make:mapping name: Name of the mapping. This name also determines the name of the index and the alias. --update: Whether the mapping should update an existing index. --template: Pass a pre-existing mapping filename to create your new mapping from. Creates a new mapping migration file.
migrate:mappings index-command: (Optional) Name of your local Artisan console command that performs the Elasticsearch indexing. If not given, command will be retrieved from laravel-elasticsearch config file. --index : Automatically index new mapping.--swap: Automatically update the alias after the indexing has finished. Migrates your mapping files and begins to create the index.
index:rollback Rollback to the previous index migration.
index:remove index: (Optional) Name of the index to remove from your Elasticsearch cluster. Removes an index from your Elasticsearch cluster.
index:swap alias: Name of alias to update. index: Name of index to update alias to. old-index: (Optional) Name of old index. --remove-old-index: Remove old index from your Elasticsearch cluster. Swap the index your alias points to.
index:list --alias: List active aliases. Pass "*" to view all. Other values filter the returned aliases. Display a list of all indexes in your Elasticsearch cluster.
index:copy from: index to copy from. to: the index to copy from Populate an index with all documents from another index

Mappings and Aliases

When creating a new index during a migrate:mappings the command will automatically create an alias based on the migration name by removing the date string. For example the migration 2018_08_03_095804_users.json will create the alias users.

During the first migration an index appears in the migrate:mappings command will also switch the alias to the latest index mapping. The above will only happen when the alias does not already exist.

Future migrations will require you to use the --swap option.


All versions of laravel-elasticsearch with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
elasticsearch/elasticsearch Version ^5.2
laravel/framework Version ^6.0 | ^7.0 | ^8.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 designmynight/laravel-elasticsearch contains the following files

Loading the files please wait ....