phlexible / elastica-bundle
phlexible elastica bundle
1.3.0
2017-08-16 12:27 UTC
Requires
- php: >=5.6.0
- ruflin/elastica: ^3.0
Requires (Dev)
- phpunit/phpunit: ^5.7
- psr/log: ^1.0
- symfony/config: ^2.8
- symfony/dependency-injection: ^2.8
- symfony/http-kernel: ^2.8
- symfony/yaml: ^2.8
README
PhlexibleElasticaBundle 在 phlexible 中添加了对 elasticsearch 索引的支持。
安装
- 使用 composer 下载 PhlexibleElasticaBundle
- 启用 Bundle
- 配置 PhlexibleElasticaBundle
- 清除 symfony 缓存
步骤 1:使用 composer 下载 PhlexibleElasticaBundle
通过运行以下命令添加 PhlexibleElasticaBundle
$ php composer.phar require phlexible/elastica-bundle "~1.0.0"
Composer 会将 Bundle 安装到您的项目的 vendor/phlexible
目录中。
步骤 2:启用 Bundle
在内核中启用 Bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Phlexible\Bundle\ElasticaBundle\PhlexibleElasticaBundle(), ); }
步骤 3:配置 PhlexibleElasticaBundle
启用 Bundle 后,您需要配置 PhlexibleElasticaBundle。将以下配置添加到您的 config.yaml 文件中。
# app/config/config.yaml phlexible_elastica: clients: default: host: your_elasticsearch_host port: 9200 logger: logger indexes: default: index_name: your_index_name
步骤 4:清除 symfony 缓存
如果您使用环境 prod 访问 phlexible 应用程序,请清除缓存
$ php app/console cache:clear --env=prod