Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are no hard and fast rules on how to structure your app using bundles, but here's what I came to after developing on Symfony2 for close to a year.</p> <p><strong>Use one app specific bundle.</strong> At first, I <a href="https://stackoverflow.com/questions/8012191/symfony2-conceptual-issue-general-bundles-vs-specific-ones/8016867#8016867">started</a> with multiple bundles like <code>CommonBundle</code>, <code>UserBundle</code>, <code>MainBundle</code>, <code>BlogBundle</code>, <code>ContactBundle</code>, etc. That proved to be not so convenient in the end, so I switched to just one app specific bundle — <code>AppBundle</code>.</p> <p>You can organize your code neatly using subnamespaces. For example, the backend controllers would go to the <code>AppBundle\Controller\Backend</code> subnamespace.</p> <p>Note that I'm talking about one <em>app specific</em> bundle — that stuff that's unique to the concrete app and won't make sense to reuse elsewhere. You can still develop separate bundles for reusable stuff and put them into the vendors infrastructure.</p> <p><strong>Keep non Symfony specific stuff out of bundles.</strong> There is no need to have a bundle for the model and the <a href="http://martinfowler.com/eaaCatalog/serviceLayer.html" rel="nofollow noreferrer">Service Layer</a> classes in a bundle if they are not Symfony2 specific. See <a href="https://stackoverflow.com/questions/9999433/should-everything-really-be-a-bundle-on-symfony-2">this question</a> and my answer for further details.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload