简体   繁体   English

Symfony 4 + FOSRESTBUNDLE

[英]Symfony 4 + FOSRESTBUNDLE

Good Evening. 晚上好。 Please i'm using Symfony 4 to create an API. 请我使用Symfony 4创建API。 I've installed the FOSRESTBUNDLE but i don't see where i can modify the configuration file of this bundle. 我已经安装了FOSRESTBUNDLE,但看不到可以在何处修改此捆绑软件的配置文件。 Please i'll like to set a configuration like fos_rest: view: #… view_response_listener: true 请设置一个像fos_rest这样的配置:view:#…view_response_listener:true

In Symfony 2, we do it in app/config/config.yml. 在Symfony 2中,我们在app / config / config.yml中进行操作。 Please Where will i do this in Symfony 4? 请在Symfony 4中在哪里进行此操作?

Look at this article: https://codereviewvideos.com/course/beginners-guide-back-end-json-api-front-end-2018/video/setup-symfony-4-fosrestbundle 看这篇文章: https : //codereviewvideos.com/course/beginners-guide-back-end-json-api-front-end-2018/video/setup-symfony-4-fosrestbundle

Check if you required this bundle with following command: 使用以下命令检查是否需要此捆绑包:

composer require friendsofsymfony/rest-bundle

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 如果使用此命令需要它,但仍然看不到文件config/packages/fos_rest.yaml执行以下命令composer fix-recipes

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 如果仍然看不到此配置文件,则可以从原始配方存储库中复制粘贴: https : //github.com/symfony/recipes-contrib/tree/master/friendsofsymfony/rest-bundle/2.2/config /包装

Also check that this bundle is included in config/bundles.php 还要检查此捆绑包是否包含在config/bundles.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM