@@ -22,13 +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],
29- Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
25+ // ...
26+
27+ // this bundle is enabled only in 'dev'
28+ Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
29+ // ...
30+
3031 // this bundle is enabled only in 'dev' and 'test', so you can't use it in 'prod'
3132 Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
33+ // ...
3234 ];
3335
3436.. tip ::
@@ -41,18 +43,18 @@ Creating a Bundle
4143-----------------
4244
4345This section creates and enables a new bundle to show there are only a few steps required.
44- 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
4547name that should be replaced by some "vendor" name that represents you or your
46- organization (e.g. AbcTestBundle for some company named ``Abc ``).
48+ organization (e.g. AbcBlogBundle for some company named ``Abc ``).
4749
48- Start by creating a new class called ``AcmeTestBundle ``::
50+ Start by creating a new class called ``AcmeBlogBundle ``::
4951
50- // src/AcmeTestBundle .php
51- namespace Acme\TestBundle ;
52+ // src/AcmeBlogBundle .php
53+ namespace Acme\BlogBundle ;
5254
5355 use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
5456
55- class AcmeTestBundle extends AbstractBundle
57+ class AcmeBlogBundle extends AbstractBundle
5658 {
5759 }
5860
@@ -68,10 +70,10 @@ Start by creating a new class called ``AcmeTestBundle``::
6870
6971.. tip ::
7072
71- The name AcmeTestBundle follows the standard
73+ The name AcmeBlogBundle follows the standard
7274 :ref: `Bundle naming conventions <bundles-naming-conventions >`. You could
73- also choose to shorten the name of the bundle to simply TestBundle by naming
74- 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 ``).
7577
7678This empty class is the only piece you need to create the new bundle. Though
7779commonly empty, this class is powerful and can be used to customize the behavior
@@ -80,10 +82,10 @@ of the bundle. Now that you've created the bundle, enable it::
8082 // config/bundles.php
8183 return [
8284 // ...
83- Acme\TestBundle\AcmeTestBundle ::class => ['all' => true],
85+ Acme\BlogBundle\AcmeBlogBundle ::class => ['all' => true],
8486 ];
8587
86- 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.
8789
8890Bundle Directory Structure
8991--------------------------
@@ -92,31 +94,31 @@ The directory structure of a bundle is meant to help to keep code consistent
9294between all Symfony bundles. It follows a set of conventions, but is flexible
9395to be adjusted if needed:
9496
95- ``src/ ``
96- 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).
97101
98102``config/ ``
99- Houses configuration, including routing configuration (e.g. ``routing.yaml ``).
100-
101- ``templates/ ``
102- Holds templates organized by controller name (e.g. ``random/index.html.twig ``).
103-
104- ``translations/ ``
105- Holds translations organized by domain and locale (e.g. ``AcmeTestBundle.en.xlf ``).
103+ Houses configuration, including routing configuration (e.g. ``routes.php ``).
106104
107105``public/ ``
108106 Contains web assets (images, compiled CSS and JavaScript files, etc.) and is
109107 copied or symbolically linked into the project ``public/ `` directory via the
110108 ``assets:install `` console command.
111109
112- ``assets/ ``
113- Contains the web asset sources (JavaScript and TypeScript files, CSS and Sass
114- files, etc.), images and other assets related to the bundle that are not in
115- ``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 ``).
116115
117116``tests/ ``
118117 Holds all tests for the bundle.
119118
119+ ``translations/ ``
120+ Holds translations organized by domain and locale (e.g. ``AcmeBlogBundle.en.xlf ``).
121+
120122.. caution ::
121123
122124 The recommended bundle structure was changed in Symfony 5, read the
@@ -127,7 +129,7 @@ to be adjusted if needed:
127129 new structure. Override the ``Bundle::getPath() `` method to change to
128130 the old structure::
129131
130- class AcmeTestBundle extends AbstractBundle
132+ class AcmeBlogBundle extends AbstractBundle
131133 {
132134 public function getPath(): string
133135 {
@@ -146,12 +148,12 @@ to be adjusted if needed:
146148 {
147149 "autoload" : {
148150 "psr-4" : {
149- "Acme\\ TestBundle \\ " : " src/"
151+ "Acme\\ BlogBundle \\ " : " src/"
150152 }
151153 },
152154 "autoload-dev" : {
153155 "psr-4" : {
154- "Acme\\ TestBundle \\ Tests\\ " : " tests/"
156+ "Acme\\ BlogBundle \\ Tests\\ " : " tests/"
155157 }
156158 }
157159 }
0 commit comments