Documentation
You are currently viewing documentation for version 3.0 which is not a long-term support release. The latest long-term support release is version 2.6

How to Create a New Bundle

According to the application directory structure, your custom bundle should be placed in the src/ folder.

To create a new bundle, first specify a name and a namespace for it.

As an illustration, let us create an AppBundle and put it under the AppBundle namespace in the /src directory ( accordingly to the application directory structure).

We need to create the corresponding directory structure and the bundle file with the following content:

1
2
3
4
5
6
7
8
9
<?php
// src/AppBundle/AppBundle.php
namespace AppBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AppBundle extends Bundle
{
}

This is basically a regular Symfony bundle. The only difference is in the way it is enabled.

Enable a Bundle

To enable the bundle:

  1. Create a Resources/config/oro/bundles.yml file with the following content:

    1
    2
    3
    # src/AppBundle/Resources/config/oro/bundles.yml
    bundles:
        - AppBundle\AppBundle
    

    or

    1
    2
    3
    # src/AppBundle/Resources/config/oro/bundles.yml
    bundles:
        - { name: AppBundle\AppBundle, priority: 210 }
    

    This file provides a list of bundles to register. All such files will be automatically parsed to load the required bundles.

    Note

    Bundles with lower priority are loaded first.

  2. Regenerate the application cache using the cache:clear console command:

    1
    2
    user@host:/var/www/vhosts/platform-application$ php bin/console cache:clear
    Clearing the cache for the dev environment with debug true
    

    Note

    If you are working in the production environment, use the –env=prod parameter with the command.

You will be redirected to [title]. Would you like to continue?

Yes No
sso for www.magecore.comsso for oroinc.desso for oroinc.fr