Search code examples
apisymfony4fosrestbundle

Symfony 4 + FOSRESTBUNDLE


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

In Symfony 2, we do it in app/config/config.yml. Please Where will i do this in Symfony 4?


Solution

  • Look at this article: 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

    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

    Also check that this bundle is included in config/bundles.php