Symfony 4 + FOSRESTBUNDLE [英] Symfony 4 + FOSRESTBUNDLE

查看:69
本文介绍了Symfony 4 + FOSRESTBUNDLE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好.请我使用 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 like fos_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?

推荐答案

看这篇文章:https://codereviewvideos.com/course/beginners-guide-back-end-json-api-front-end-2018/视频/设置-symfony-4-fosrestbundle

使用以下命令检查您是否需要此包:

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 command composer 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆