@@ -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
@@ -67,10 +70,10 @@ Start by creating a new class called ``AcmeTestBundle``::
6770
6871.. tip ::
6972
70- The name AcmeTestBundle follows the standard
73+ The name AcmeBlogBundle follows the standard
7174 :ref: `Bundle naming conventions <bundles-naming-conventions >`. You could
72- also choose to shorten the name of the bundle to simply TestBundle by naming
73- this class TestBundle (and naming the file ``TestBundle .php ``).
75+ also choose to shorten the name of the bundle to simply BlogBundle by naming
76+ this class BlogBundle (and naming the file ``BlogBundle .php ``).
7477
7578This empty class is the only piece you need to create the new bundle. Though
7679commonly empty, this class is powerful and can be used to customize the behavior
@@ -79,10 +82,10 @@ of the bundle. Now that you've created the bundle, enable it::
7982 // config/bundles.php
8083 return [
8184 // ...
82- Acme\TestBundle\AcmeTestBundle ::class => ['all' => true],
85+ Acme\BlogBundle\AcmeBlogBundle ::class => ['all' => true],
8386 ];
8487
85- And while it doesn't do anything yet, AcmeTestBundle is now ready to be used.
88+ And while it doesn't do anything yet, AcmeBlogBundle is now ready to be used.
8689
8790Bundle Directory Structure
8891--------------------------
@@ -91,31 +94,31 @@ The directory structure of a bundle is meant to help to keep code consistent
9194between all Symfony bundles. It follows a set of conventions, but is flexible
9295to be adjusted if needed:
9396
94- ``src/ ``
95- Contains all PHP classes related to the bundle logic (e.g. ``Controller/RandomController.php ``).
97+ ``assets/ ``
98+ Contains the web asset sources like JavaScript and TypeScript files, CSS and
99+ Sass files, but also images and other assets related to the bundle that are
100+ not in ``public/ `` (e.g. Stimulus controllers).
96101
97102``config/ ``
98- Houses configuration, including routing configuration (e.g. ``routing.yaml ``).
99-
100- ``templates/ ``
101- Holds templates organized by controller name (e.g. ``random/index.html.twig ``).
102-
103- ``translations/ ``
104- Holds translations organized by domain and locale (e.g. ``AcmeTestBundle.en.xlf ``).
103+ Houses configuration, including routing configuration (e.g. ``routes.php ``).
105104
106105``public/ ``
107106 Contains web assets (images, compiled CSS and JavaScript files, etc.) and is
108107 copied or symbolically linked into the project ``public/ `` directory via the
109108 ``assets:install `` console command.
110109
111- ``assets/ ``
112- Contains the web asset sources (JavaScript and TypeScript files, CSS and Sass
113- files, etc.), images and other assets related to the bundle that are not in
114- ``public/ `` (e.g. Stimulus controllers)
110+ ``src/ ``
111+ Contains all PHP classes related to the bundle logic (e.g. ``Controller/CategoryController.php ``).
112+
113+ ``templates/ ``
114+ Holds templates organized by controller name (e.g. ``category/show.html.twig ``).
115115
116116``tests/ ``
117117 Holds all tests for the bundle.
118118
119+ ``translations/ ``
120+ Holds translations organized by domain and locale (e.g. ``AcmeBlogBundle.en.xlf ``).
121+
119122.. caution ::
120123
121124 The recommended bundle structure was changed in Symfony 5, read the
@@ -126,7 +129,7 @@ to be adjusted if needed:
126129 new structure. Override the ``Bundle::getPath() `` method to change to
127130 the old structure::
128131
129- class AcmeTestBundle extends AbstractBundle
132+ class AcmeBlogBundle extends AbstractBundle
130133 {
131134 public function getPath(): string
132135 {
@@ -145,12 +148,12 @@ to be adjusted if needed:
145148 {
146149 "autoload" : {
147150 "psr-4" : {
148- "Acme\\ TestBundle \\ " : " src/"
151+ "Acme\\ BlogBundle \\ " : " src/"
149152 }
150153 },
151154 "autoload-dev" : {
152155 "psr-4" : {
153- "Acme\\ TestBundle \\ Tests\\ " : " tests/"
156+ "Acme\\ BlogBundle \\ Tests\\ " : " tests/"
154157 }
155158 }
156159 }
0 commit comments