Symfony 2.6 : The good momentum to implement “official” Symfony best practices
Symfony 2.6 released yesterday. There are ton of features/bug fixes added. There is another thing that awesome! We can implements the “AppBundle way” of the official best practices. Although the
AppBundle that mentioned in the official documentation brought by Symfony 2.6, is not in Symfony-standard yet ( at least until now), we can generate it by new updated SensioGeneratorBundle that already shipped by new symfony-standard.
@jota_developer the AppBundle does not come by default yet (it will soon). But, there is nothing special, you can generate it🙂—
Ryan Weaver (@weaverryan) November 29, 2014
So, after you generate :
php app/console generate:bundle --namespace=AppBundle \ --dir=src --format=annotation --no-interaction
Now, you can have bundle without “vendor” namespace.
Then, if you do what mentioned in the best practices, that template location in app/Resources instead (for templates that the bundle only used in your application). The project structure will like the following :
There are complete list of “official” recommended ways to build application using Symfony application including configuration, controllers, templates, forms, internationalization, security, web assets, and tests.
One more thing, now, we can use Symfony Installer to create a new Symfony application that you can download from https://github.com/symfony/symfony-installer . The console interface of installer is pretty good :