1

I have an application written with Symfony and want to merge some small bundles as part of that app.

Regarding the quick Symfony2 bundle tour from Sonata, I need an ApplicationBundle.

quick Symfony2 bundle tour:

  • There are two types of bundles:
    • Application Bundle (AB),
    • Vendor Bundle (VB), that should not be modified inside a project.
  • The AB directory is where developers implement the project requirements,
  • An AB can overwrite almost everything from a VB, example: you can redefine a VB template at the AB level.

(Source)

Symfony documentation says about architecture:

The directory structure of a Symfony application is rather flexible, but the recommended structure is as follows:

  • app/: the application configuration;
  • src/: the project's PHP code;
  • vendor/: the third-party dependencies;
  • web/: the web root directory

(Source)

But where shall I place it?

There are two possibilities:

  • app/Application (Sonata EasyExtends places ApplicationBundles here)
  • src

But what is the right one?
And why are there two possibilities?

The Symfony documentation doesn't cover ApplicationBundle.

Thanks for any hints.

CSchulz
  • 10,882
  • 11
  • 60
  • 114
  • 2
    You should place your application and its bundles within the src folder. So i.e. src > YourApplication > YourFunctionalityBundle – axelvnk Sep 23 '14 at 10:54

1 Answers1

0

The documentation say that :

  • Application Bundles (in 2 words, this is important) are stored in src/ directory.
  • Vendor Bundles are stored in vendor/directory (and came from your composer.json dependencies).

You can (and should) create many bundles for you application.

Yann Eugoné
  • 1,311
  • 1
  • 8
  • 17
  • In this case, what is the sense of **app/Application**? – CSchulz Sep 23 '14 at 11:34
  • I'm not sure that you can have bundles in the `app` directory. I can't even see why I whould store a bundle here instead of `vendor`. – Yann Eugoné Sep 23 '14 at 11:59
  • 1
    There is no sense to app/Application. Your configuration (AppKernel, config.yml etc) goes under app. Any actual code ends up under src. – Cerad Sep 23 '14 at 14:11