{"id":17989486,"url":"https://github.com/evilfreelancer/laravel-manticoresearch","last_synced_at":"2025-03-25T23:30:44.559Z","repository":{"id":62503213,"uuid":"269397584","full_name":"EvilFreelancer/laravel-manticoresearch","owner":"EvilFreelancer","description":"An easy way to use the official ManticoreSearch client in your Laravel or Lumen applications.","archived":false,"fork":false,"pushed_at":"2024-02-09T07:04:01.000Z","size":29,"stargazers_count":23,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-20T22:09:33.157Z","etag":null,"topics":["laravel","laravel-package","lumen","lumen-package","manticoresearch"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvilFreelancer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://pay.cloudtips.ru/p/937f48ac","https://boosty.to/evilfreelancer"]}},"created_at":"2020-06-04T15:34:02.000Z","updated_at":"2024-12-03T15:33:14.000Z","dependencies_parsed_at":"2024-10-29T19:20:54.764Z","dependency_job_id":null,"html_url":"https://github.com/EvilFreelancer/laravel-manticoresearch","commit_stats":{"total_commits":39,"total_committers":2,"mean_commits":19.5,"dds":0.02564102564102566,"last_synced_commit":"a30e909872e6cf0e928e6d448c8f5245e1d99653"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Flaravel-manticoresearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Flaravel-manticoresearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Flaravel-manticoresearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Flaravel-manticoresearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvilFreelancer","download_url":"https://codeload.github.com/EvilFreelancer/laravel-manticoresearch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245561137,"owners_count":20635680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-package","lumen","lumen-package","manticoresearch"],"created_at":"2024-10-29T19:14:47.823Z","updated_at":"2025-03-25T23:30:42.640Z","avatar_url":"https://github.com/EvilFreelancer.png","language":"PHP","funding_links":["https://pay.cloudtips.ru/p/937f48ac","https://boosty.to/evilfreelancer"],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/evilfreelancer/laravel-manticoresearch/v/stable)](https://packagist.org/packages/evilfreelancer/laravel-manticoresearch)\n[![Total Downloads](https://poser.pugx.org/evilfreelancer/laravel-manticoresearch/downloads)](https://packagist.org/packages/evilfreelancer/laravel-manticoresearch)\n[![Build Status](https://scrutinizer-ci.com/g/EvilFreelancer/laravel-manticoresearch/badges/build.png?b=master)](https://scrutinizer-ci.com/g/EvilFreelancer/laravel-manticoresearch/build-status/master)\n[![Code Coverage](https://scrutinizer-ci.com/g/EvilFreelancer/laravel-manticoresearch/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/EvilFreelancer/laravel-manticoresearch/?branch=master)\n[![Code Climate](https://codeclimate.com/github/EvilFreelancer/laravel-manticoresearch/badges/gpa.svg)](https://codeclimate.com/github/EvilFreelancer/laravel-manticoresearch)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/EvilFreelancer/laravel-manticoresearch/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/EvilFreelancer/laravel-manticoresearch/?branch=master)\n[![License](https://poser.pugx.org/evilfreelancer/laravel-manticoresearch/license)](https://packagist.org/packages/evilfreelancer/laravel-manticoresearch)\n\n# Laravel ManticoreSearch plugin\n\nAn easiest way to use the [official ManticoreSearch client](https://github.com/manticoresoftware/manticoresearch-php)\nin your Laravel or Lumen applications.\n\n```sh\ncomposer require evilfreelancer/laravel-manticoresearch\n```\n\n* [Post install](#Post-install)\n    * [Laravel](#Laravel)\n    * [Lumen](#Lumen)\n* [How to use](#How-to-use)\n* [Logging](#Logging)\n* [Links](#Links)\n\n## Post install\n\n### Laravel\n\nThe package's service provider will automatically register its service provider.\n\nPublish the configuration file:\n\n```sh\nphp artisan vendor:publish --provider=\"ManticoreSearch\\Laravel\\ServiceProvider\"\n```\n\n#### Alternative configuration method via .env file\n\nAfter you publish the configuration file as suggested above, you may configure ManticoreSearch by adding the following\nto your application's `.env` file (with appropriate values):\n\n```dotenv\nMANTICORESEARCH_HOST=localhost\nMANTICORESEARCH_PORT=9200\nMANTICORESEARCH_TRANSPORT=Http\nMANTICORESEARCH_USER=\nMANTICORESEARCH_PASS=\n```\n\n#### All available environments variables\n\n| Name                               | Default value  | Description |\n|------------------------------------|----------------|-------------|\n| MANTICORESEARCH_CONNECTION         | default        | Name of default connection |\n| MANTICORESEARCH_HOST               | localhost      | Address of host with Manticore server |\n| MANTICORESEARCH_PORT               | 9308           | Port number with REST server |\n| MANTICORESEARCH_TRANSPORT          | Http           | Type of transport, can be: Http, Https, PhpHttp or your custom driver |\n| MANTICORESEARCH_USER               |                | Username |\n| MANTICORESEARCH_PASS               |                | Password |\n| MANTICORESEARCH_TIMEOUT            | 5              | Timeout between requests |\n| MANTICORESEARCH_CONNECTION_TIMEOUT | 1              | Timeout before connection |\n| MANTICORESEARCH_PROXY              |                | Url of HTTP proxy server |\n| MANTICORESEARCH_PERSISTENT         | true           | Define whenever connection is persistent or not |\n| MANTICORESEARCH_RETRIES            | 2              | Amount of retries if connection is lost |\n\n### Lumen\n\nIf you work with Lumen, please register the service provider and configuration in `bootstrap/app.php`:\n\n```php\n// Enable shortname of facade\n$app-\u003ewithFacades(true, [\n    'ManticoreSearch\\Laravel\\Facade' =\u003e 'Facade',\n]);\n\n// Register Config Files\n$app-\u003econfigure('manticoresearch');\n\n// Register Service Providers\n$app-\u003eregister(ManticoreSearch\\Laravel\\ServiceProvider::class);\n```\n\nManually copy the configuration file to your application.\n\n## How to use\n\nThe `ManticoreSearch` facade is just an entry point into\nthe [ManticoreSearch client](https://github.com/manticoresoftware/manticoresearch-php), so previously you might have\nused:\n\n```php\nrequire_once __DIR__ . '/vendor/autoload.php';\n\n$config = ['host'=\u003e'127.0.0.1', 'port'=\u003e9308];\n$client = new \\Manticoresearch\\Client($config);\n$index  = new \\Manticoresearch\\Index($client);\n$index-\u003esetName('movies'); \n``` \n\nInstead of these few lines above you can use single line solution:\n\n```php\n$index = \\ManticoreSearch::index('movies');\n```\n\nThat will run the command on the default connection. You can run a command on any connection (see\nthe [defaultConnection](https://github.com/EvilFreelancer/laravel-manticoresearch/blob/master/config/manticoresearch.php#L9)\nsetting\nand [connections](https://github.com/EvilFreelancer/laravel-manticoresearch/blob/master/config/manticoresearch.php#L11)\narray in the configuration file).\n\n```php\n$index   = \\ManticoreSearch::connection('connectionName')-\u003eindex($nameOfIndex);\n$pq      = \\ManticoreSearch::connection('connectionName')-\u003epq();\n$cluster = \\ManticoreSearch::connection('connectionName')-\u003ecluster();\n$indices = \\ManticoreSearch::connection('connectionName')-\u003eindices();\n$nodes   = \\ManticoreSearch::connection('connectionName')-\u003enodes();\n\n// etc...\n```\n\nmethods of the Client class:\n\n```php\n\\ManticoreSearch::connection('connectionName')-\u003esql($params);\n\\ManticoreSearch::connection('connectionName')-\u003ereplace($params);\n\\ManticoreSearch::connection('connectionName')-\u003edelete($params);\n\n// etc...\n```\n\nLumen users who aren't using facades will need to use dependency injection, or the application container in order to get\nthe ManticoreSearch Index object:\n\n```php\n// using injection:\npublic function handle(\\ManticoreSearch\\Laravel\\Manager $manticoresearch)\n{\n    $manticoresearch-\u003edescribe();\n}\n\n// using application container:\n$manticoreSearch = $this-\u003eapp('manticoresearch');\n```\n\nOf course, dependency injection and the application container work for Laravel applications as well.\n\n## Logging\n\nSince the PHP client of the ManticoreSearch supports logging through PSR-compatible loggers, you can use them in the\nsame way as presented in the\n[official documentation](https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/logging.md).\n\nFor example, you want to use the Monolog logger.\n\n```shell\ncomposer require monolog/monolog\n```\n\nBy default, you need to write something like this:\n\n```php\n$logger = new \\Monolog\\Logger('name');\n$logger-\u003epushHandler(new \\Monolog\\Handler\\StreamHandler('/my/log.file', Logger::INFO));\n$config = ['host' =\u003e '127.0.0.1', 'port' =\u003e 9306];\n$client = new \\Manticoresearch\\Client($config, $logger);\n$index  = new \\Manticoresearch\\Index($client);\n$index-\u003esetName('movies');\n```\n\nBut if you want to use the Monolog together with this library then you may simplify your code like this:\n\n```php\n$logger = new \\Monolog\\Logger('name');\n$logger-\u003epushHandler(new \\Monolog\\Handler\\StreamHandler('/my/log.file', Logger::INFO));\n\n$index = \\ManticoreSearch::connection('connectionName', $logger)-\u003eindex('movies');\n```\n\n## Testing\n\nJust install dev requirements `composer install --dev`, then execute following command from root of this library:\n\n```shell\n./vendor/bin/phpunit\n```\n\n## Links\n\n* https://github.com/manticoresoftware/manticoresearch-php\n* https://github.com/cviebrock/laravel-elasticsearch\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilfreelancer%2Flaravel-manticoresearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilfreelancer%2Flaravel-manticoresearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilfreelancer%2Flaravel-manticoresearch/lists"}