Download the PHP package torann/laravel-hunt without Composer

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

Laravel Hunt

Latest Stable Version Total Downloads Patreon donate button Donate weekly to this project using Gratipay Donate to this project using Flattr Donate to this project using Paypal

Unified search for Laravel models using Elasticsearch. Laravel Hunt uses the official Elasticsearch PHP API. To get started, you should have a basic knowledge of how Elasticsearch works (indexes, types, mappings, etc).

Elasticsearch Requirements

You must be running Elasticsearch 5.0 or higher.

Installation

Composer

From the command line run:

Laravel

Once installed you need to register the service provider with the application. Open up config/app.php and find the providers key.

Lumen

For Lumen register the service provider in bootstrap/app.php.

Publish the configurations

Run this on the command line from the root of your project:

A configuration file will be publish to config/hunt.php.

Indexes and Mapping

While you can definitely build your indexes and mapping through the Elasticsearch API, you can also use some helper methods to build indexes and types right from your models.

For custom analyzer, you can set an settings property in the config/hunt.php file:

For mapping, you can set a mappingProperties property in your model and use some mapping functions from there:

Artisan Commands

hunt:install

Create the Elasticsearch index.

hunt:uninstall

Remove the Elasticsearch index.

hunt:map <model>

Initialize an Eloquent model map.

Arguments:

hunt:import <model>

Import all the entries in an Eloquent model. This will also initialize the model's map if one is not already set.

Arguments:

hunt:flush <model>

Flush all of the model's records from the index.

Arguments:

Indexing

Once you have added the LaravelHunt\Huntable trait to a model, all you need to do is save a model instance and it will automatically be added to your index.

Note: if the model record is already in your index, it will be updated. If it does not exist in the index, it will be added.

Updating Records

To update an index model, you only need to update the model instance's properties and `save`` the model to your database. Hunt will automatically persist the changes to your search index:

Removing Records

To remove a record from your index, simply delete the model from the database. This form of removal is even compatible with soft deleted models:

Searching

You may begin searching a model using the search method. The search method accepts a single string that will be used to search your models. You should then chain the get method onto the search query to retrieve the Eloquent models that match the given search query:

Since Hunt searches return a collection of Eloquent models, you may even return the results directly from a route or controller and they will automatically be converted to JSON:

Pagination

In addition to retrieving a collection of models, you may paginate your search results using the paginate method. This method will return a Paginator instance just as if you had paginated a traditional Eloquent query:

You may specify how many models to retrieve per page by passing the amount as the first argument to the paginate method:

Once you have retrieved the results, you may display the results and render the page links using Blade just as if you had paginated a traditional Eloquent query:

Multilingual

This feature is experimental

Laravel Hunt can support multiple languages by appending the language code to the index type, so when the system performs a search it will only look for data that is on in the current system locale suffixed index type. For this to work the model needs to use the LaravelHunt\Localized trait or something similar to it and model needs to have the filed locale.

For more information see the config file for more details.


All versions of laravel-hunt with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
illuminate/support Version ~5.2
illuminate/database Version ~5.2
illuminate/config Version ~5.2
elasticsearch/elasticsearch Version ~5.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 torann/laravel-hunt contains the following files

Loading the files please wait ....