问题描述
晚上好.请我使用 Symfony 4 来创建 API.我已经安装了 FOSRESTBUNDLE,但我看不到在哪里可以修改这个包的配置文件.请我想设置一个配置fos_rest:看法:#…view_response_listener:真
Good Evening. Please i'm using Symfony 4 to create an API. I've installed the FOSRESTBUNDLE but i don't see where i can modify the configuration file of this bundle. Please i'll like to set a configuration likefos_rest: view: #… view_response_listener: true
在 Symfony 2 中,我们在 app/config/config.yml 中进行.请问我将在 Symfony 4 中的哪里执行此操作?
In Symfony 2, we do it in app/config/config.yml. Please Where will i do this in Symfony 4?
推荐答案
使用以下命令检查您是否需要此包:
Check if you required this bundle with following command:
composer 需要friendsofsymfony/rest-bundle
如果你用这个命令需要它但你仍然没有看到文件 config/packages/fos_rest.yaml
执行以下命令composer fix-recipes
If you require it with this command but you still don't see file config/packages/fos_rest.yaml
execute following commandcomposer fix-recipes
如果你仍然没有看到这个配置文件,你可以从原始配方库复制粘贴它:https://github.com/symfony/recipes-contrib/tree/master/friendsofsymfony/rest-bundle/2.2/config/packages
If you still don't see this config file, you can just copy-paste it from original recipe repository: https://github.com/symfony/recipes-contrib/tree/master/friendsofsymfony/rest-bundle/2.2/config/packages
还要检查这个包是否包含在 config/bundles.php
Also check that this bundle is included in config/bundles.php
这篇关于Symfony 4 + FOSRESTBUNDLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!