@@ -4,53 +4,36 @@ Creating the Project
44Installing Symfony
55------------------
66
7- In the past, Symfony projects were created with `Composer `_, the dependency manager
8- for PHP applications. However, the current recommendation is to use the **Symfony
9- Installer **, which has to be installed before creating your first project.
10-
117..best-practice ::
128
13- Use the SymfonyInstaller to create new Symfony-based projects.
9+ Use the` SymfonySkeleton `_ and ` Composer `_ to create new Symfony-based projects.
1410
15- Read the:doc: `/setup ` article learn how to install and use the Symfony
16- Installer.
11+ The **Symfony Skeleton ** is a minimal and empty Symfony project which you can
12+ base your new projects on. Unlike past Symfony versions, this skeleton installs
13+ the absolute bare minimum amount of dependencies to make a fully working Symfony
14+ project. Read the:doc: `/setup ` article to learn more about installing Symfony.
1715
1816.. _linux-and-mac-os-x-systems :
1917.. _windows-systems :
2018
2119Creating the Blog Application
2220-----------------------------
2321
24- Now that everything is correctly set up, you can create a new project based on
25- Symfony. In your command console, browse to a directory where you have permission
26- to create files and execute the following commands:
22+ In your command console, browse to a directory where you have permission to
23+ create files and execute the following commands:
2724
2825..code-block ::terminal
2926
3027 $ cd projects/
31- $ symfony new blog
32-
33- # Windows
34- c:\> cd projects/
35- c:\projects\> php symfony new blog
36-
37- ..note ::
38-
39- If the installer doesn't work for you or doesn't output anything, make sure
40- that the `Phar extension `_ is installed and enabled on your computer.
28+ $ composer create-project symfony/skeleton blog
4129
4230 This command creates a new directory called ``blog `` that contains a fresh new
43- project based on the most recent stable Symfony version available. In addition,
44- the installer checks if your system meets the technical requirements to execute
45- Symfony applications. If not, you'll see the list of changes needed to meet those
46- requirements.
31+ project based on the most recent stable Symfony version available.
4732
4833..tip ::
4934
50- Symfony releases are digitally signed for security reasons. If you want to
51- verify the integrity of your Symfony installation, take a look at the
52- `public checksums repository `_ and follow `these steps `_ to verify the
53- signatures.
35+ The technical requirements to run Symfony are simple. If you want to check
36+ if your system meets those requirements, read:doc: `/reference/requirements `.
5437
5538Structuring the Application
5639---------------------------
@@ -61,47 +44,29 @@ number of files and directories generated automatically:
6144..code-block ::text
6245
6346 blog/
64- ├─ app/
65- │ ├─ config/
66- │ └─ Resources/
67- ├─ bin
47+ ├─ bin/
6848 │ └─ console
49+ ├─ config/
50+ └─ public/
51+ │ └─ index.php
6952 ├─ src/
70- │ └─AppBundle/
53+ │ └─Kernel.php
7154 ├─ var/
7255 │ ├─ cache/
73- │ ├─ logs/
74- │ └─ sessions/
75- ├─ tests/
76- │ └─ AppBundle/
77- ├─ vendor/
78- └─ web/
56+ │ └─ log/
57+ └─ vendor/
7958
8059 This file and directory hierarchy is the convention proposed by Symfony to
81- structure your applications. The recommended purpose of each directory is the
82- following:
83-
84- * ``app/config/ ``, stores all the configuration defined for any environment;
85- * ``app/Resources/ ``, stores all the templates and the translation files for the
86- application;
87- * ``src/AppBundle/ ``, stores the Symfony specific code (controllers and routes),
88- your domain code (e.g. Doctrine classes) and all your business logic;
89- * ``var/cache/ ``, stores all the cache files generated by the application;
90- * ``var/log/ ``, stores all the log files generated by the application;
91- * ``var/sessions/ ``, stores all the session files generated by the application;
92- * ``tests/AppBundle/ ``, stores the automatic tests (e.g. Unit tests) of the
93- application.
94- * ``vendor/ ``, this is the directory where Composer installs the application's
95- dependencies and you should never modify any of its contents;
96- * ``web/ ``, stores all the front controller files and all the web assets, such
97- as stylesheets, JavaScript files and images.
60+ structure your applications. It's recommended to keep this structure because it's
61+ easy to navigate and most directory names are self-explanatory, but you can
62+ :doc: `override the location of any Symfony directory </configuration/override_dir_structure >`:
9863
9964Application Bundles
10065~~~~~~~~~~~~~~~~~~~
10166
10267When Symfony 2.0 was released, most developers naturally adopted the symfony
103681.x way of dividing applications into logical modules. That's why many Symfony
104- appsuse bundles to divide their code into logical features: UserBundle,
69+ appsused bundles to divide their code into logical features: UserBundle,
10570ProductBundle, InvoiceBundle, etc.
10671
10772But a bundle is *meant * to be something that can be reused as a stand-alone
@@ -111,64 +76,11 @@ ProductBundle, then there's no advantage to having two separate bundles.
11176
11277..best-practice ::
11378
114- Create only one bundle called AppBundle for your application logic.
115-
116- Implementing a single AppBundle bundle in your projects will make your code
117- more concise and easier to understand.
118-
119- ..note ::
120-
121- There is no need to prefix the AppBundle with your own vendor (e.g.
122- AcmeAppBundle), because this application bundle is never going to be
123- shared.
124-
125- ..note ::
126-
127- Another reason to create a new bundle is when you're overriding something
128- in a vendor's bundle (e.g. a controller). See:doc: `/bundles/inheritance `.
129-
130- All in all, this is the typical directory structure of a Symfony application
131- that follows these best practices:
132-
133- ..code-block ::text
134-
135- blog/
136- ├─ app/
137- │ ├─ config/
138- │ └─ Resources/
139- ├─ bin/
140- │ └─ console
141- ├─ src/
142- │ └─ AppBundle/
143- ├─ tests/
144- │ └─ AppBundle/
145- ├─ var/
146- │ ├─ cache/
147- │ ├─ logs/
148- └─ sessions/
149- ├─ vendor/
150- └─ web/
151- ├─ app.php
152- └─ app_dev.php
153-
154- ..tip ::
155-
156- If your Symfony installation doesn't come with a pre-generated AppBundle,
157- you can generate it by hand executing this command:
158-
159- ..code-block ::terminal
160-
161- $ php bin/console generate:bundle --namespace=AppBundle --dir=src --format=annotation --no-interaction
162-
163- Extending the Directory Structure
164- ---------------------------------
79+ Don't create any bundle to organize your application logic.
16580
166- If your project or infrastructure requires some changes to the default directory
167- structure of Symfony, you can
168- :doc: `override the location of the main directories </configuration/override_dir_structure >`:
169- ``cache/ ``, ``logs/ `` and ``web/ ``.
81+ Symfony applications can still use third-party bundles (installed in ``vendor/ ``)
82+ to add features, but you should use PHP namespaces instead of bundles to organize
83+ your own code.
17084
85+ .. _`Symfony Skeleton` :https://github.com/symfony/skeleton
17186.. _`Composer` :https://getcomposer.org/
172- .. _`Phar extension` :http://php.net/manual/en/intro.phar.php
173- .. _`public checksums repository` :https://github.com/sensiolabs/checksums
174- .. _`these steps` :http://fabien.potencier.org/signing-project-releases.html