Skip to content

Commit

Permalink
Updating 'Exploring the Project'
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Nov 28, 2015
1 parent 6b5c977 commit 0d69414
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
1 change: 1 addition & 0 deletions book/bundles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Now that you've created the bundle, enable it via the ``AppKernel`` class::
{
$bundles = array(
// ...

// register your bundle
new Acme\TestBundle\AcmeTestBundle(),
);
Expand Down
49 changes: 30 additions & 19 deletions book/page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
// ...
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -168,8 +168,8 @@ at the end:
.. code-block:: php-annotations
// src/AppBundle/Controller/LuckyController.php
// ...
// ...
class LuckyController extends Controller
{
/**
Expand All @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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
{
/**
Expand Down Expand Up @@ -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}")
*/
Expand Down Expand Up @@ -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
(``var/cache/``) and logs (``var/logs/``).

``vendor/``
Vendor (i.e. third-party) libraries and bundles are downloaded here by
the `Composer`_ package manager. You should never need to manually edit
something in this directory.

.. seealso::

Symfony is flexible. If you need to, you can easily override the default
Expand All @@ -475,8 +486,8 @@ is ``app/config/config.yml``:
.. code-block:: yaml
# app/config/config.yml
# ...
# ...
framework:
secret: "%secret%"
router:
Expand Down Expand Up @@ -548,7 +559,7 @@ use the handy ``bin/console`` command:

.. code-block:: bash
$ bin/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
Expand Down

0 comments on commit 0d69414

Please sign in to comment.