8000 feature #3613 Javiereguiluz revamped quick tour (weaverryan) · symfony/symfony-docs@9dcf467 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9dcf467

Browse files
committed
feature #3613 Javiereguiluz revamped quick tour (weaverryan)
This PR was merged into the 2.3 branch. Discussion ---------- Javiereguiluz revamped quick tour Hey guys! See #3562 - this is the same, but rebased against the 2.3 branch. | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | 2.3+ | Fixed tickets | Off of the top of my head (but I could be wrong), the only thing that was 2.4 specific is the version number used in the composer.phar create-project command. We could fix this in 2 different ways: 1) Don't fix it - just always keep that number updated to the latest released version. We do this similarly in other places 2) Use "@stable" as the version constraint. I don't know of any drawbacks. Thanks! Commits ------- 1e36cfa [quick_tour] rewording and grammar fixes noted by @xabbuh 69fdff1 [quick_tour] removed an unneeded comma 30624eb [quick_tour] more rewording and grammar fixes 0f13ce9 [quick_tour] rewording and grammar fixes suggested by @weaverryan 7c0037e Restored all the original introductions for each tutorial part cb98a6c Restored the original line that explained how a routing file is imported from a bundle fdc755e Grammar fixes proposed by @weaverryan and @wouterj eca1e73 Added a more useful message for users that don't have PHP 5.4 and try to execute the server:run command a013b11 Removed the animated GIF showing how to install Symfony 985c68f Replaced "variable" by "placeholder" when using {_format} inside a route 42bd69f Fixed the capitalization of a section heading 75be815 Minor rewording c1ad15d Added a new headline to better structure the documentation b16c3a2 Capitalized some sentences that come after a colon 2fdcffd When using server:run command, it's not necessary to add the `app_dev.php` controller 6afc80b Removed a wrongly inserted comma e004661 Bundle names should not be placed in literals 38b1292 [quick_tour] removed inline links 81d6e20 [quick_tour] replaced "chapter" by "part" in some tutorial parts 50e136c [quick_tour] second pass to "the architecture" chapter cdb7064 [quick_tour] second pass to "the controller" chapter and added a section about displaying error pages 2cd3bab [quick tour] second pass to "the view" chapter 4ad3c44 [quick_tour] second pass to the "big picture" chapter e7dfc8b [quick_tour] simplified "the architecture" chapter eb3fe4c [quick tour] simplified "the controller" chapter dbbc8c2 [quick_tour] updated "the view" chapter 5b3a572 [quick_tour] finished the review of "The Big Picture" chapter f24eabc [quick_tour] updated some screenshots 20e9fb0 [quick_tour] updated the "Controllers" section 29992cd [quick_tour] simplified the "routing" section a84a556 [quick_tour] simplified drastically the first two sections of "The Big Picture" chapter
2 parents fc0aa8b + 1e36cfa commit 9dcf467

File tree

8 files changed

+263
-459
lines changed

8 files changed

+263
-459
lines changed

images/quick_tour/hello_fabien.png

41 KB
Loading

images/quick_tour/profiler.png

804 KB
Loading
39.4 KB
Loading

images/quick_tour/welcome.png

66.3 KB
Loading

quick_tour/the_architecture.rst

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ Understanding the Directory Structure
1111
-------------------------------------
1212

1313
The directory structure of a Symfony2 :term:`application` is rather flexible,
14-
but the directory structure of the *Standard Edition* distribution reflects
15-
the typical and recommended structure of a Symfony2 application:
14+
but the recommended structure is as follows:
1615

17-
* ``app/``: The application configuration;
18-
* ``src/``: The project's PHP code;
19-
* ``vendor/``: The third-party dependencies;
20-
* ``web/``: The web root directory.
16+
* ``app/``: the application configuration;
17+
* ``src/``: the project's PHP code;
18+
* ``vendor/``: the third-party dependencies;
19+
* ``web/``: the web root directory.
2120

2221
The ``web/`` Directory
2322
~~~~~~~~~~~~~~~~~~~~~~
@@ -36,11 +35,10 @@ lives::
3635
$kernel->loadClassCache();
3736
$kernel->handle(Request::createFromGlobals())->send();
3837

39-
The kernel first requires the ``bootstrap.php.cache`` file, which bootstraps
40-
the framework and registers the autoloader (see below).
41-
42-
Like any front controller, ``app.php`` uses a Kernel Class, ``AppKernel``, to
43-
bootstrap the application.
38+
The controller first bootstraps the application using a kernel class (``AppKernel``
39+
in this case). Then, it creates the ``Request`` object using the PHP's global
40+
variables and passes it to the kernel. The last step is to send the response
41+
contents returned by the kernel back to the user.
4442

4543
.. _the-app-dir:
4644

@@ -59,17 +57,11 @@ This class must implement two methods:
5957
(more on this later).
6058

6159
Autoloading is handled automatically via `Composer`_, which means that you
62-
can use any PHP clas 8000 ses without doing anything at all! If you need more flexibility,
63-
you can extend the autoloader in the ``app/autoload.php`` file. All dependencies
60+
can use any PHP class without doing anything at all! All dependencies
6461
are stored under the ``vendor/`` directory, but this is just a convention.
6562
You can store them wherever you want, globally on your server or locally
6663
in your projects.
6764

68-
.. note::
69-
70-
If you want to learn more about Composer's autoloader, read `Composer-Autoloader`_.
71-
Symfony also has an autoloading component - read ":doc:`/components/class_loader/class_loader`".
72-
7365
Understanding the Bundle System
7466
-------------------------------
7567

@@ -79,12 +71,13 @@ Symfony2, the :term:`bundle` system.
7971
A bundle is kind of like a plugin in other software. So why is it called a
8072
*bundle* and not a *plugin*? This is because *everything* is a bundle in
8173
Symfony2, from the core framework features to the code you write for your
82-
application. Bundles are first-class citizens in Symfony2. This gives you
83-
the flexibility to use pre-built features packaged in third-party bundles
84-
or to distribute your own bundles. It makes it easy to pick and choose which
85-
features to enable in your application and optimize them the way you want.
86-
And at the end of the day, your application code is just as *important* as
87-
the core framework itself.
74+
application.
75+
76+
Bundles are first-class citizens in Symfony2. This gives you the flexibility
77+
to use pre-built features packaged in third-party bundles or to distribute your
78+
own bundles. It makes it easy to pick and choose which features to enable in
79+
your application and optimize them the way you want. And at the end of the day,
80+
your application code is just as *important* as the core framework itself.
8881

8982
Registering a Bundle
9083
~~~~~~~~~~~~~~~~~~~~
@@ -119,14 +112,14 @@ a single ``Bundle`` class that describes it::
119112

120113
In addition to the AcmeDemoBundle that was already talked about, notice
121114
that the kernel also enables other bundles such as the FrameworkBundle,
122-
DoctrineBundle, SwiftmailerBundle, and AsseticBundle bundle.
123-
They are all part of the core framework.
115+
DoctrineBundle, SwiftmailerBundle and AsseticBundle bundle. They are all part
116+
of the core framework.
124117

125118
Configuring a Bundle
126119
~~~~~~~~~~~~~~~~~~~~
127120

128121
Each bundle can be customized via configuration files written in YAML, XML, or
129-
PHP. Have a look at the default configuration:
122+
PHP. Have a look at the default Symfony configuration:
130123

131124
.. code-block:: yaml
132125
@@ -191,9 +184,9 @@ PHP. Have a look at the default configuration:
191184
password: "%mailer_password%"
192185
spool: { type: memory }
193186
194-
Each entry like ``framework`` defines the configuration for a specific bundle.
195-
For example, ``framework`` configures the FrameworkBundle while ``swiftmailer``
196-
configures the SwiftmailerBundle.
187+
Each first level entry like ``framework``, ``twig`` or ``doctrine`` defines the
188+
configuration for a specific bundle. For example, ``framework`` configures the
189+
FrameworkBundle while ``swiftmailer`` configures the SwiftmailerBundle.
197190

198191
Each :term:`environment` can override the default configuration by providing a
199192
specific configuration file. For example, the ``dev`` environment loads the
@@ -268,7 +261,7 @@ Extending Bundles
268261

269262
If you follow these conventions, then you can use :doc:`bundle inheritance</cookbook/bundles/inheritance>`
270263
to "override" files, controllers or templates. For example, you can create
271-
a bundle - ``AcmeNewBundle`` - and specify that it overrides AcmeDemoBundle.
264+
a bundle - AcmeNewBundle - and specify that it overrides AcmeDemoBundle.
272265
When Symfony loads the ``AcmeDemoBundle:Welcome:index`` controller, it will
273266
first look for the ``WelcomeController`` class in AcmeNewBundle and, if
274267
it doesn't exist, then look inside AcmeDemoBundle. This means that one bundle
@@ -296,8 +289,9 @@ each request? The speed is partly due to its cache system. The application
296289
configuration is only parsed for the very first request and then compiled down
297290
to plain PHP code stored in the ``app/cache/`` directory. In the development
298291
environment, Symfony2 is smart enough to flush the cache when you change a
299-
file. But in the production environment, it is your responsibility to clear
300-
the cache when you update your code or change its configuration.
292+
file. But in the production environment, to speed things up, it is your
293+
responsibility to clear the cache when you update your code or change its
294+
configuration.
301295

302296
When developing a web application, things can go wrong in many ways. The log
303297
files in the ``app/logs/`` directory tell you everything about the requests
@@ -336,4 +330,3 @@ topics now? Look no further - go to the official :doc:`/book/index` and pick
336330
any topic you want.
337331

338332
.. _Composer: http://getcomposer.org
339-
.. _`Composer-Autoloader`: http://getcomposer.org/doc/01-basic-usage.md#autoloading

0 commit comments

Comments
 (0)
0