yii2-extensions / elasticsearch
Elasticsearch integration and ActiveRecord for the Yii framework.
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
Type:yii2-extension
Requires
- php: >=8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- yii2-extensions/debug: dev-main
- yiisoft/yii2: ^2.2
Requires (Dev)
- maglnet/composer-require-checker: ^4.6
- phpunit/phpunit: ^10.4
- yii2-extensions/phpstan: dev-main
This package is auto-updated.
Last update: 2024-10-30 14:16:46 UTC
README
Elasticsearch Query and ActiveRecord.
This extension provides the Elasticsearch integration for the Yii framework 2.0.
It includes basic querying/search support and also implements the ActiveRecord
pattern that allows you to store active
records in Elasticsearch.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --dev --prefer-dist yii2-extensions/elasticsearch
or add
"yii2-extensions/elasticsearch": "dev-main"
to the require section of your composer.json
file.
Usage
To use this extension, you have to configure the Connection class in your application configuration:
use yii\elasticsearch\Connection; return [ //.... 'components' => [ 'elasticsearch' => [ 'class' => Connection::class, 'nodes' => [ ['http_address' => '127.0.0.1:9200'], // configure more hosts if you have a cluster ], 'dslVersion' => 7, // default is 5 ], ] ];
Configure with yiisoft/config
Add the following code to your
config/config-plugin
file in your application.
'config-plugin' => [ 'web' => [ '$yii2-elasticsearch', // add this line 'web/*.php' ], ],
Testing
Check the documentation testing to learn about testing.
Our social networks
License
The MIT License. Please see License File for more information.