@@ -22,12 +22,15 @@ file::
2222 return [
2323 // 'all' means that the bundle is enabled for any Symfony environment
2424 Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
25- Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
26- Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
27- Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
28- Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
25+ // ...
26+
27+ // this bundle is enabled only in 'dev'
28+ Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
29+ // ...
30+
2931 // this bundle is enabled only in 'dev' and 'test', so you can't use it in 'prod'
3032 Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
33+ // ...
3134 ];
3235
3336.. tip ::
@@ -40,18 +43,18 @@ Creating a Bundle
4043-----------------
4144
4245This section creates and enables a new bundle to show there are only a few steps required.
43- The new bundle is called AcmeTestBundle , where the ``Acme `` portion is an example
46+ The new bundle is called AcmeBlogBundle , where the ``Acme `` portion is an example
4447name that should be replaced by some "vendor" name that represents you or your
45- organization (e.g. AbcTestBundle for some company named ``Abc ``).
48+ organization (e.g. AbcBlogBundle for some company named ``Abc ``).
4649
47- Start by creating a new class called ``AcmeTestBundle ``::
50+ Start by creating a new class called ``AcmeBlogBundle ``::
4851
49- // src/AcmeTestBundle .php
50- namespace Acme\TestBundle ;
52+ // src/AcmeBlogBundle .php
53+ namespace Acme\BlogBundle ;
5154
5255 use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
5356
54- class AcmeTestBundle extends AbstractBundle
57+ class AcmeBlogBundle extends AbstractBundle
5558 {
5659 }
5760
@@ -62,10 +65,10 @@ Start by creating a new class called ``AcmeTestBundle``::
6265
6366.. tip ::
6467
65- The name AcmeTestBundle follows the standard
68+ The name AcmeBlogBundle follows the standard
6669 :ref: `Bundle naming conventions <bundles-naming-conventions >`. You could
67- also choose to shorten the name of the bundle to simply TestBundle by naming
68- this class TestBundle (and naming the file ``TestBundle .php ``).
70+ also choose to shorten the name of the bundle to simply BlogBundle by naming
71+ this class BlogBundle (and naming the file ``BlogBundle .php ``).
6972
7073This empty class is the only piece you need to create the new bundle. Though
7174commonly empty, this class is powerful and can be used to customize the behavior
@@ -74,10 +77,10 @@ of the bundle. Now that you've created the bundle, enable it::
7477 // config/bundles.php
7578 return [
7679 // ...
77- Acme\TestBundle\AcmeTestBundle ::class => ['all' => true],
80+ Acme\BlogBundle\AcmeBlogBundle ::class => ['all' => true],
7881 ];
7982
80- And while it doesn't do anything yet, AcmeTestBundle is now ready to be used.
83+ And while it doesn't do anything yet, AcmeBlogBundle is now ready to be used.
8184
8285Bundle Directory Structure
8386--------------------------
@@ -86,31 +89,31 @@ The directory structure of a bundle is meant to help to keep code consistent
8689between all Symfony bundles. It follows a set of conventions, but is flexible
8790to be adjusted if needed:
8891
89- ``src/ ``
90- Contains all PHP classes related to the bundle logic (e.g. ``Controller/RandomController.php ``).
92+ ``assets/ ``
93+ Contains the web asset sources like JavaScript and TypeScript files, CSS and
94+ Sass files, but also images and other assets related to the bundle that are
95+ not in ``public/ `` (e.g. Stimulus controllers).
9196
9297``config/ ``
93- Houses configuration, including routing configuration (e.g. ``routing.yaml ``).
94-
95- ``templates/ ``
96- Holds templates organized by controller name (e.g. ``random/index.html.twig ``).
97-
98- ``translations/ ``
99- Holds translations organized by domain and locale (e.g. ``AcmeTestBundle.en.xlf ``).
98+ Houses configuration, including routing configuration (e.g. ``routes.php ``).
10099
101100``public/ ``
102101 Contains web assets (images, compiled CSS and JavaScript files, etc.) and is
103102 copied or symbolically linked into the project ``public/ `` directory via the
104103 ``assets:install `` console command.
105104
106- ``assets/ ``
107- Contains the web asset sources (JavaScript and TypeScript files, CSS and Sass
108- files, etc.), images and other assets related to the bundle that are not in
109- ``public/ `` (e.g. Stimulus controllers)
105+ ``src/ ``
106+ Contains all PHP classes related to the bundle logic (e.g. ``Controller/CategoryController.php ``).
107+
108+ ``templates/ ``
109+ Holds templates organized by controller name (e.g. ``category/show.html.twig ``).
110110
111111``tests/ ``
112112 Holds all tests for the bundle.
113113
114+ ``translations/ ``
115+ Holds translations organized by domain and locale (e.g. ``AcmeBlogBundle.en.xlf ``).
116+
114117.. caution ::
115118
116119 The recommended bundle structure was changed in Symfony 5, read the
@@ -121,7 +124,7 @@ to be adjusted if needed:
121124 new structure. Override the ``Bundle::getPath() `` method to change to
122125 the old structure::
123126
124- class AcmeTestBundle extends AbstractBundle
127+ class AcmeBlogBundle extends AbstractBundle
125128 {
126129 public function getPath(): string
127130 {
@@ -140,12 +143,12 @@ to be adjusted if needed:
140143 {
141144 "autoload" : {
142145 "psr-4" : {
143- "Acme\\ TestBundle \\ " : " src/"
146+ "Acme\\ BlogBundle \\ " : " src/"
144147 }
145148 },
146149 "autoload-dev" : {
147150 "psr-4" : {
148- "Acme\\ TestBundle \\ Tests\\ " : " tests/"
151+ "Acme\\ BlogBundle \\ Tests\\ " : " tests/"
149152 }
150153 }
151154 }
0 commit comments