gpt4 book ai didi

symfony - Silex + FOQElasticaBundle

转载 作者:行者123 更新时间:2023-12-03 02:08:50 26 4
gpt4 key购买 nike

我的目标是将FOQElasticBundle与我的Silex网站链接。
问题是FOQElasticBundle的documentationn声明我只需要在config.yml文件中放入一些基本内容即可。

另请:https://github.com/Exercise/FOQElasticaBundle#declare-a-client

到目前为止,我在任何地方都找不到config.yml文件,我也不知道是否必须创建它,以及是否在哪里放置它。
我使用Silex而不是Symfony本身在网站上做出了错误的选择吗?
还是可以加载FOQElasticBundle?

最佳答案

您不能直接在Silex中使用Symfony bundle 包。
Silex通过服务提供者集成了第三方库,这些服务提供者就像第三方库的某种适配器一样。

如果您想使用 bundle 包,我建议您最好使用Symfony。

否则,您可以尝试自己为Elastica库添加write a Service Provider
或直接将其集成,如下所示:
https://github.com/4devs/demo-silex/blob/master/web/index.php

$app['elastica.host'] = "localhost";
$app['elastica.port'] = 9200;

$app['elastica'] = function ($app) {
return new \Elastica\Client(array(
'host' => $app['elastica.host'],
'port' => $app['elastica.port']
));
};

不幸的是,这里没有列出Elastica服务提供商:
https://github.com/silexphp/Silex/wiki/Third-Party-ServiceProviders

关于symfony - Silex + FOQElasticaBundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20195569/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com