-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.0][Book] Use the 3.0 directory structure #5913
Changes from 5 commits
8794a4d
1461bdc
3318f2e
6b5c977
0d69414
ed43015
25ae8c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,13 +122,13 @@ FrameworkBundle configuration: | |
|
||
.. code-block:: bash | ||
|
||
$ app/console config:dump-reference FrameworkBundle | ||
$ bin/console config:dump-reference FrameworkBundle | ||
|
||
The extension alias (configuration key) can also be used: | ||
|
||
.. code-block:: bash | ||
|
||
$ app/console config:dump-reference framework | ||
$ bin/console config:dump-reference framework | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here: In most commands we use |
||
|
||
.. note:: | ||
|
||
|
@@ -177,7 +177,7 @@ cached files and allow them to rebuild: | |
|
||
.. code-block:: bash | ||
|
||
$ php app/console cache:clear --env=prod --no-debug | ||
$ php bin/console cache:clear --env=prod --no-debug | ||
|
||
.. note:: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,8 +102,8 @@ Suppose you want to create a JSON endpoint that returns the lucky number. | |
Just add a second method to ``LuckyController``:: | ||
|
||
// src/AppBundle/Controller/LuckyController.php | ||
// ... | ||
|
||
// ... | ||
class LuckyController extends Controller | ||
{ | ||
// ... | ||
|
@@ -132,8 +132,8 @@ Try this out in your browser: | |
You can even shorten this with the handy :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`:: | ||
|
||
// src/AppBundle/Controller/LuckyController.php | ||
// ... | ||
|
||
// ... | ||
// --> don't forget this new use statement | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
|
||
|
@@ -168,8 +168,8 @@ at the end: | |
.. code-block:: php-annotations | ||
|
||
// src/AppBundle/Controller/LuckyController.php | ||
// ... | ||
|
||
// ... | ||
class LuckyController extends Controller | ||
{ | ||
/** | ||
|
@@ -192,7 +192,7 @@ at the end: | |
|
||
.. code-block:: xml | ||
|
||
<!-- src/Acme/DemoBundle/Resources/config/routing.xml --> | ||
<!-- app/config/routing.xml --> | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<routes xmlns="http://symfony.com/schema/routing" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
|
@@ -206,7 +206,7 @@ at the end: | |
|
||
.. code-block:: php | ||
|
||
// src/Acme/DemoBundle/Resources/config/routing.php | ||
// app/config/routing.php | ||
use Symfony\Component\Routing\RouteCollection; | ||
use Symfony\Component\Routing\Route; | ||
|
||
|
@@ -274,8 +274,8 @@ to use Twig - or many other tools in Symfony - is to extend Symfony's base | |
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller` class:: | ||
|
||
// src/AppBundle/Controller/LuckyController.php | ||
// ... | ||
|
||
// ... | ||
// --> add this new use statement | ||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
|
||
|
@@ -296,8 +296,8 @@ Twig templates, another that can log messages and many more. | |
To render a Twig template, use a service called ``templating``:: | ||
|
||
// src/AppBundle/Controller/LuckyController.php | ||
// ... | ||
|
||
// ... | ||
class LuckyController extends Controller | ||
{ | ||
/** | ||
|
@@ -329,8 +329,8 @@ But this can get even easier! By extending the ``Controller`` class, you | |
also get a lot of shortcut methods, like ``render()``:: | ||
|
||
// src/AppBundle/Controller/LuckyController.php | ||
// ... | ||
|
||
// ... | ||
/** | ||
* @Route("/lucky/number/{count}") | ||
*/ | ||
|
@@ -434,30 +434,41 @@ worked inside the two most important directories: | |
else). As you get more advanced, you'll learn what can be done inside each | ||
of these. | ||
|
||
The ``app/`` directory also holds a few other things, like the cache directory | ||
``app/cache/``, the logs directory ``app/logs/`` and ``app/AppKernel.php``, | ||
which you'll use to enable new bundles (and one of a *very* short list of | ||
The ``app/`` directory also holds some other things, like ``app/AppKernel.php``, | ||
which you'll use to enable new bundles (this is one of a *very* short list of | ||
PHP files in ``app/``). | ||
|
||
The ``src/`` directory has just one directory - ``src/AppBundle`` - | ||
and everything lives inside of it. A bundle is like a "plugin" and you can | ||
`find open source bundles`_ and install them into your project. But even | ||
*your* code lives in a bundle - typically ``AppBundle`` (though there's | ||
nothing special about ``AppBundle``). To find out more about bundles and | ||
*your* code lives in a bundle - typically *AppBundle* (though there's | ||
nothing special about AppBundle). To find out more about bundles and | ||
why you might create multiple bundles (hint: sharing code between projects), | ||
see the :doc:`Bundles </book/bundles>` chapter. | ||
|
||
So what about the other directories in the project? | ||
|
||
``vendor/`` | ||
Vendor (i.e. third-party) libraries and bundles are downloaded here by | ||
the `Composer`_ package manager. | ||
|
||
``web/`` | ||
This is the document root for the project and contains any publicly accessible | ||
files, like CSS, images and the Symfony front controllers that execute | ||
the app (``app_dev.php`` and ``app.php``). | ||
|
||
``tests/`` | ||
The automatic tests (e.g. Unit tests) of your application live here. | ||
|
||
``bin/`` | ||
The "binary" files live here. The most important one is the ``console`` | ||
file which is used to execute Symfony commands via the console. | ||
|
||
``var/`` | ||
This is were automatically created files are stored, like cache files | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
(``var/cache/``) and logs (``var/logs/``). | ||
|
||
``vendor/`` | ||
Vendor (i.e. third-party) libraries and bundles are downloaded here by | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of:
What about:
|
||
the `Composer`_ package manager. You should never need to manually edit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could be more strict here. Instead of "you should never need to edit..." -> "you should never edit ..." |
||
something in this directory. | ||
|
||
.. seealso:: | ||
|
||
Symfony is flexible. If you need to, you can easily override the default | ||
|
@@ -475,8 +486,8 @@ is ``app/config/config.yml``: | |
.. code-block:: yaml | ||
|
||
# app/config/config.yml | ||
# ... | ||
|
||
# ... | ||
framework: | ||
secret: "%secret%" | ||
router: | ||
|
@@ -544,11 +555,11 @@ by changing one option in this configuration file. To find out how, see the | |
:doc:`Configuration Reference </reference/index>` section. | ||
|
||
Or, to get a big example dump of all of the valid configuration under a key, | ||
use the handy ``app/console`` command: | ||
use the handy ``bin/console`` command: | ||
|
||
.. code-block:: bash | ||
|
||
$ app/console config:dump-reference framework | ||
$ php bin/console config:dump-reference framework | ||
|
||
There's a lot more power behind Symfony's configuration system, including | ||
environments, imports and parameters. To learn all of it, see the | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In most commands we use
php bin
instead ofbin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, updated it already (these commands currently didn't work for Windows users).