Download the PHP package evilfreelancer/laravel-manticoresearch without Composer
On this page you can find all versions of the php package evilfreelancer/laravel-manticoresearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download evilfreelancer/laravel-manticoresearch
More information about evilfreelancer/laravel-manticoresearch
Files in evilfreelancer/laravel-manticoresearch
Package laravel-manticoresearch
Short Description An easy way to use the official ManticoreSearch client in your Laravel applications
License MIT
Homepage https://github.com/EvilFreelancer/laravel-manticoresearch
Informations about the package laravel-manticoresearch
Laravel ManticoreSearch plugin
An easiest way to use the official ManticoreSearch client in your Laravel or Lumen applications.
- Post install
- Laravel
- Lumen
- How to use
- Logging
- Links
Post install
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 ManticoreSearch by adding the following
to your application's .env
file (with appropriate values):
All available environments variables
Name | Default value | Description |
---|---|---|
MANTICORESEARCH_CONNECTION | default | Name of default connection |
MANTICORESEARCH_HOST | localhost | Address of host with Manticore server |
MANTICORESEARCH_PORT | 9308 | Port number with REST server |
MANTICORESEARCH_TRANSPORT | Http | Type of transport, can be: Http, Https, PhpHttp or your custom driver |
MANTICORESEARCH_USER | Username | |
MANTICORESEARCH_PASS | Password | |
MANTICORESEARCH_TIMEOUT | 5 | Timeout between requests |
MANTICORESEARCH_CONNECTION_TIMEOUT | 1 | Timeout before connection |
MANTICORESEARCH_PROXY | Url of HTTP proxy server | |
MANTICORESEARCH_PERSISTENT | true | Define whenever connection is persistent or not |
MANTICORESEARCH_RETRIES | 2 | Amount of retries if connection is lost |
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.
How to use
The ManticoreSearch
facade is just an entry point into
the ManticoreSearch client, so previously you might have
used:
Instead of these few lines above you can use single line solution:
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).
methods of the Client class:
Lumen users who aren't using facades will need to use dependency injection, or the application container in order to get the ManticoreSearch Index object:
Of course, dependency injection and the application container work for Laravel applications as well.
Logging
Since the PHP client of the ManticoreSearch supports logging through PSR-compatible loggers, you can use them in the same way as presented in the official documentation.
For example, you want to use the Monolog logger.
By default, you need to write something like this:
But if you want to use the Monolog together with this library then you may simplify your code like this:
Testing
Just install dev requirements composer install --dev
, then execute following command from root of this library:
Links
All versions of laravel-manticoresearch with dependencies
ext-json Version *
psr/log Version >=1.1
manticoresoftware/manticoresearch-php Version ^1.6
illuminate/support Version ^6.0|^7.0|^8.0
illuminate/contracts Version ^6.0|^7.0|^8.0