1

May I change the default Symfony2 structure to fit my needs? I like the follow structure, but don't know how to get it to working..

core/ <- Symfony2 core files
app/ <- All applications
app/Acme/ <- Application for Acme enterprise (with all bundles..)
app/clientone.com/ <- Application for Client One enterprise (with all bundles..)
j0k
  • 22,600
  • 28
  • 79
  • 90
Gabriel Santos
  • 4,934
  • 2
  • 43
  • 74

1 Answers1

3

Inside symfony2 distribution there are 4 main directories:

  • app (there are customisations to your app)
  • vendors (symfony and other libraries)
  • src (your source code which may or may not to be application specific, there could be bundle ClientoneBundle which is specific to only this application, but also could be a bundle reused among your applications,- such as UserBundle)
  • web (http document root)

So if you have several applications you could keep vendors separately. And each of your application may contain three directories like: - apps/acme/app - apps/acme/src - apps/acme/web - apps/clientone/app - apps/clientone/src - apps/clientone/web - some/where/else/in/filesystem/vendor

To implement such setup is very easy,- all you have to do is edit your autoload.php (which resides in app dir), just replace everywhere __DIR__.'/../vendor to __DIR__.'/../vendor, in other words, tell symfony2 that you moved vendors somewhere else.

(I just renamed app directory in your setup to apps - to be not confused with app directory, inside each of your application)

Luke 10X
  • 1,071
  • 2
  • 14
  • 30