"Fossies" - the Fresh Open Source Software Archive

Member "phplist-3.5.0/public_html/lists/base/vendor/friendsofsymfony/rest-bundle/Resources/doc/1-setting_up_the_bundle.rst" (3 Jan 2019, 1735 Bytes) of package /linux/www/phplist-3.5.0.tgz:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

Step 1: Setting up the bundle

A) Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require friendsofsymfony/rest-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.


If you are not using Flex, you also have to enable the bundle by adding the following line in the app/AppKernel.php:

// app/AppKernel.php
class AppKernel extends Kernel
    public function registerBundles()
        $bundles = [
            // ...
            new FOS\RestBundle\FOSRestBundle(),

        // ...

B) Enable a Serializer

This bundle needs a serializer to work correctly. In most cases, you'll need to enable a serializer or install one. This bundle tries the following (in the given order) to determine the serializer to use:

  1. The one you configured using fos_rest.service.serializer (if you did).
  2. The JMS serializer, if the JMSSerializerBundle is available (and registered).
  3. The Symfony Serializer if it's enabled (or any service called serializer).

That was it!