1
1
The Architecture
2
2
================
3
3
4
- You are my hero! Who would have thought that you would still be here after the
5
- first three parts? Your efforts will be well rewarded soon. The first three
6
- parts didn't look too deeply at the architecture of the framework. Because it
7
- makes Symfony2 stand apart from the framework crowd, let's dive into the
8
- architecture now.
4
+ The first three parts of this tutorial didn't look too deeply at the
5
+ architecture of the framework. Because it makes Symfony2 stand apart from the
6
+ framework crowd, let's dive into the architecture now.
9
7
10
8
Understanding the Directory Structure
11
9
-------------------------------------
12
10
13
11
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:
12
+ but the recommended structure is as follows:
16
13
17
- * ``app/ ``: The application configuration;
18
- * ``src/ ``: The project's PHP code;
19
- * ``vendor/ ``: The third-party dependencies;
20
- * ``web/ ``: The web root directory.
14
+ * ``app/ ``: the application configuration;
15
+ * ``src/ ``: the project's PHP code;
16
+ * ``vendor/ ``: the third-party dependencies;
17
+ * ``web/ ``: the web root directory.
21
18
22
19
The ``web/ `` Directory
23
20
~~~~~~~~~~~~~~~~~~~~~~
@@ -36,11 +33,9 @@ lives::
36
33
$kernel->loadClassCache();
37
34
$kernel->handle(Request::createFromGlobals())->send();
38
35
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.
36
+ The controller first requires the ``bootstrap.php.cache `` file, which bootstraps
37
+ the framework and registers the autoloader (see below). Then, it uses a kernel
38
+ class, ``AppKernel `` in this case, to bootstrap the application.
44
39
45
40
.. _the-app-dir :
46
41
@@ -65,11 +60,6 @@ are stored under the ``vendor/`` directory, but this is just a convention.
65
60
You can store them wherever you want, globally on your server or locally
66
61
in your projects.
67
62
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
-
73
63
Understanding the Bundle System
74
64
-------------------------------
75
65
@@ -296,8 +286,9 @@ each request? The speed is partly due to its cache system. The application
296
286
configuration is only parsed for the very first request and then compiled down
297
287
to plain PHP code stored in the ``app/cache/ `` directory. In the development
298
288
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.
289
+ file. But in the production environment, to speed things up, it is your
290
+ responsibility to clear the cache when you update your code or change its
291
+ configuration.
301
292
302
293
When developing a web application, things can go wrong in many ways. The log
303
294
files in the ``app/logs/ `` directory tell you everything about the requests
@@ -336,4 +327,3 @@ topics now? Look no further - go to the official :doc:`/book/index` and pick
336
327
any topic you want.
337
328
338
329
.. _Composer : http://getcomposer.org
339
- .. _`Composer-Autoloader` : http://getcomposer.org/doc/01-basic-usage.md#autoloading
0 commit comments