-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Improving "The Quick Tour" tutorial #3562
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
Closed
Closed
Changes from 13 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
0b442c7
[quick_tour] simplified drastically the first two sections of "The Bi…
javiereguiluz 6e5a6a2
[quick_tour] simplified the "routing" section
javiereguiluz 63f671c
[quick_tour] updated the "Controllers" section
javiereguiluz 8a1db94
[quick_tour] updated some screenshots
javiereguiluz b6c1721
[quick_tour] finished the review of "The Big Picture" chapter
javiereguiluz 7c8c38c
[quick_tour] updated "the view" chapter
javiereguiluz be8787c
[quick tour] simplified "the controller" chapter
javiereguiluz 3a2fd71
[quick_tour] simplified "the architecture" chapter
javiereguiluz f48cbf1
[quick_tour] second pass to the "big picture" chapter
javiereguiluz 905e3e6
[quick tour] second pass to "the view" chapter
javiereguiluz cce8145
[quick_tour] second pass to "the controller" chapter and
javiereguiluz 1e1deb0
[quick_tour] second pass to "the architecture" chapter
javiereguiluz f57ad39
[quick_tour] replaced "chapter" by "part" in some tutorial parts
javiereguiluz 0d4da93
[quick_tour] removed inline links
javiereguiluz deced02
Bundle names should not be placed in literals
javiereguiluz 53ba9d5
Removed a wrongly inserted comma
javiereguiluz 4a4635d
When using server:run command, it's not necessary to add the `app_dev…
javiereguiluz 89c7dd3
Capitalized some sentences that come after a colon
javiereguiluz bd1fc95
Added a new headline to better structure the documentation
javiereguiluz 7cfc1d9
Minor rewording
javiereguiluz a22d663
Fixed the capitalization of a section heading
javiereguiluz 9f04dae
Replaced "variable" by "placeholder" when using {_format} inside a route
javiereguiluz f810f4a
Removed the animated GIF showing how to install Symfony
javiereguiluz cef3103
Added a more useful message for users that don't have PHP 5.4
javiereguiluz 1ed3dc9
Grammar fixes proposed by @weaverryan and @WouterJ
javiereguiluz c7d3fac
Restored the original line that explained how a routing file is imported
javiereguiluz fa1d018
Restored all the original introductions for each tutorial part
javiereguiluz 304d4ce
[quick_tour] rewording and grammar fixes suggested by @weaverryan
javiereguiluz 3b430f8
[quick_tour] more rewording and grammar fixes
javiereguiluz c911698
[quick_tour] removed an unneeded comma
javiereguiluz ef88ae2
[quick_tour] rewording and grammar fixes noted by @xabbuh
javiereguiluz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
The Architecture | ||
================ | ||
|
||
You are my hero! Who would have thought that you would still be here after the | ||
first three parts? Your efforts will be well rewarded soon. The first three | ||
parts didn't look too deeply at the architecture of the framework. Because it | ||
makes Symfony2 stand apart from the framework crowd, let's dive into the | ||
architecture now. | ||
The first three parts of this tutorial didn't look too deeply at the | ||
architecture of the framework. Because it makes Symfony2 stand apart from the | ||
framework crowd, let's dive into the architecture now. | ||
|
||
Understanding the Directory Structure | ||
------------------------------------- | ||
|
||
The directory structure of a Symfony2 :term:`application` is rather flexible, | ||
but the directory structure of the *Standard Edition* distribution reflects | ||
the typical and recommended structure of a Symfony2 application: | ||
but the recommended structure is as follows: | ||
|
||
* ``app/``: The application configuration; | ||
* ``src/``: The project's PHP code; | ||
* ``vendor/``: The third-party dependencies; | ||
* ``web/``: The web root directory. | ||
* ``app/``: the application configuration; | ||
* ``src/``: the project's PHP code; | ||
* ``vendor/``: the third-party dependencies; | ||
* ``web/``: the web root directory. | ||
|
||
The ``web/`` Directory | ||
~~~~~~~~~~~~~~~~~~~~~~ | ||
|
@@ -36,11 +33,10 @@ lives:: | |
$kernel->loadClassCache(); | ||
$kernel->handle(Request::createFromGlobals())->send(); | ||
|
||
The kernel first requires the ``bootstrap.php.cache`` file, which bootstraps | ||
the framework and registers the autoloader (see below). | ||
|
||
Like any front controller, ``app.php`` uses a Kernel Class, ``AppKernel``, to | ||
bootstrap the application. | ||
The controller first bootstraps the application using a kernel class (``AppKernel`` | ||
in this case). Then, it creates the ``Request`` object using the PHP's global | ||
variables and passes it to the kernel. The last step is to send back to the user | ||
the response contents returned by the kernel. | ||
|
||
.. _the-app-dir: | ||
|
||
|
@@ -59,17 +55,11 @@ This class must implement two methods: | |
|
||
Autoloading is handled automatically via `Composer`_, which means that you | ||
can use any PHP classes without doing anything at all! If you need more flexibility, | ||
you can extend the autoloader in the ``app/autoload.php`` file. All dependencies | ||
can use any PHP classes without doing anything at all! All dependencies | ||
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. any PHP class (singular)? |
||
are stored under the ``vendor/`` directory, but this is just a convention. | ||
You can store them wherever you want, globally on your server or locally | ||
in your projects. | ||
|
||
.. note:: | ||
|
||
If you want to learn more about Composer's autoloader, read `Composer-Autoloader`_. | ||
Symfony also has an autoloading component - read ":doc:`/components/class_loader/class_loader`". | ||
|
||
Understanding the Bundle System | ||
------------------------------- | ||
|
||
|
@@ -79,12 +69,13 @@ Symfony2, the :term:`bundle` system. | |
A bundle is kind of like a plugin in other software. So why is it called a | ||
*bundle* and not a *plugin*? This is because *everything* is a bundle in | ||
Symfony2, from the core framework features to the code you write for your | ||
application. Bundles are first-class citizens in Symfony2. This gives you | ||
the flexibility to use pre-built features packaged in third-party bundles | ||
or to distribute your own bundles. It makes it easy to pick and choose which | ||
features to enable in your application and optimize them the way you want. | ||
And at the end of the day, your application code is just as *important* as | ||
the core framework itself. | ||
application. | ||
|
||
Bundles are first-class citizens in Symfony2. This gives you the flexibility | ||
to use pre-built features packaged in third-party bundles or to distribute your | ||
own bundles. It makes it easy to pick and choose which features to enable in | ||
your application and optimize them the way you want. And at the end of the day, | ||
your application code is just as *important* as the core framework itself. | ||
|
||
Registering a Bundle | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
@@ -119,14 +110,14 @@ a single ``Bundle`` class that describes it:: | |
|
||
In addition to the AcmeDemoBundle that was already talked about, notice | ||
that the kernel also enables other bundles such as the FrameworkBundle, | ||
DoctrineBundle, SwiftmailerBundle, and AsseticBundle bundle. | ||
They are all part of the core framework. | ||
DoctrineBundle, SwiftmailerBundle, and AsseticBundle bundle. They are all part | ||
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. The comma after SwiftmailerBundle should be removed. |
||
of the core framework. | ||
|
||
Configuring a Bundle | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Each bundle can be customized via configuration files written in YAML, XML, or | ||
PHP. Have a look at the default configuration: | ||
PHP. Have a look at the default Symfony configuration: | ||
|
||
.. code-block:: yaml | ||
|
||
|
@@ -191,9 +182,9 @@ PHP. Have a look at the default configuration: | |
password: "%mailer_password%" | ||
spool: { type: memory } | ||
|
||
Each entry like ``framework`` defines the configuration for a specific bundle. | ||
For example, ``framework`` configures the FrameworkBundle while ``swiftmailer`` | ||
configures the SwiftmailerBundle. | ||
Each first level entry like ``framework``, ``twig`` or ``doctrine`` defines the | ||
configuration for a specific bundle. For example, ``framework`` configures the | ||
FrameworkBundle while ``swiftmailer`` configures the SwiftmailerBundle. | ||
|
||
Each :term:`environment` can override the default configuration by providing a | ||
specific configuration file. For example, the ``dev`` environment loads the | ||
|
@@ -296,8 +287,9 @@ each request? The speed is partly due to its cache system. The application | |
configuration is only parsed for the very first request and then compiled down | ||
to plain PHP code stored in the ``app/cache/`` directory. In the development | ||
environment, Symfony2 is smart enough to flush the cache when you change a | ||
file. But in the production environment, it is your responsibility to clear | ||
the cache when you update your code or change its configuration. | ||
file. But in the production environment, to speed things up, it is your | ||
responsibility to clear the cache when you update your code or change its | ||
configuration. | ||
|
||
When developing a web application, things can go wrong in many ways. The log | ||
files in the ``app/logs/`` directory tell you everything about the requests | ||
|
@@ -336,4 +328,3 @@ topics now? Look no further - go to the official :doc:`/book/index` and pick | |
any topic you want. | ||
|
||
.. _Composer: http://getcomposer.org | ||
.. _`Composer-Autoloader`: http://getcomposer.org/doc/01-basic-usage.md#autoloading |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I feel that
The last step is to send the response contents returned by the kernel back to the user.