2828Linux and Mac OS X Systems
2929~~~~~~~~~~~~~~~~~~~~~~~~~~
3030
31- Open your command console and execute the following commands::
31+ Open your command console and execute the following commands:
3232
3333.. code-block :: bash
3434
@@ -40,14 +40,14 @@ This will create a global ``symfony`` command in your system.
4040Windows Systems
4141~~~~~~~~~~~~~~~
4242
43- Open your command console and execute the following command::
43+ Open your command console and execute the following command:
4444
4545.. code-block :: bash
4646
4747 c:\> php -r " readfile('https://symfony.com/installer');" > symfony
4848
4949 Then, move the downloaded ``symfony `` file to your project's directory and
50- execute it as follows::
50+ execute it as follows:
5151
5252.. code-block :: bash
5353
@@ -60,7 +60,7 @@ Creating the Symfony Application
6060--------------------------------
6161
6262Once the Symfony Installer is available, create your first Symfony application
63- with the ``new `` command::
63+ with the ``new `` command:
6464
6565.. code-block :: bash
6666
@@ -92,7 +92,7 @@ Basing your Project on a Specific Symfony Version
9292~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9393
9494In case your project needs to be based on a specific Symfony version, use the
95- optional second argument of the ``new `` command::
95+ optional second argument of the ``new `` command:
9696
9797.. code-block :: bash
9898
@@ -109,7 +109,7 @@ optional second argument of the ``new`` command::
109109 $ symfony new my_project 2.7.0-RC1
110110
111111 The installer also supports a special version called ``lts `` which installs the
112- most recent :ref: `Symfony LTS version <releases-lts >` available::
112+ most recent :ref: `Symfony LTS version <releases-lts >` available:
113113
114114.. code-block :: bash
115115
@@ -141,14 +141,14 @@ Creating a Symfony Application with Composer
141141~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142142
143143Once Composer is installed on your computer, execute the ``create-project `` Composer
144- command to create a new Symfony application based on its latest stable version::
144+ command to create a new Symfony application based on its latest stable version:
145145
146146.. code-block :: bash
147147
148148 $ composer create-project symfony/framework-standard-edition my_project_name
149149
150150 If you need to base your application on a specific Symfony version, provide that
151- version as the second argument of the ``create-project `` Composer command::
151+ version as the second argument of the ``create-project `` Composer command:
152152
153153.. code-block :: bash
154154
@@ -160,14 +160,12 @@ version as the second argument of the ``create-project`` Composer command::
160160 doing anything. If that's your case, add the ``-vvv `` flag to the previous
161161 command to display a detailed output of everything that Composer is doing.
162162
163- $ composer create-project -vvv symfony/framework-standard-edition my_project_name "2.3.*"
164-
165163Running the Symfony Application
166164-------------------------------
167165
168166Symfony leverages the internal web server provided by PHP to run applications
169167while developing them. Therefore, running a Symfony application is a matter of
170- browsing the project directory and executing this command::
168+ browsing the project directory and executing this command:
171169
172170.. code-block :: bash
173171
@@ -187,16 +185,12 @@ possible solutions depending on your operating system. All of them are
187185explained in the :ref: `Setting up Permissions <book-installation-permissions >`
188186section of this chapter.
189187
190- Using PHP's internal web server is only suitable while developing the application.
191- In order to run Symfony applications on production servers, you'll have to
192- configure your `Apache `_ or `Nginx `_ web server and virtual host as explained in
193- cookbook article :doc: `/cookbook/configuration/web_server_configuration `.
188+ PHP's internal web server is great for developing, but should **not ** be used on
189+ production. Instead, use Apache or Nginx. See :doc: `/cookbook/configuration/web_server_configuration `.
194190
195191.. note ::
196192
197- PHP's internal web server is available in PHP 5.4 or higher versions. So, if you
198- still use the legacy PHP 5.3 version, you'll also have to configure `Apache `_ or
199- `Nginx `_ web server and virtual host.
193+ PHP's internal web server is available in PHP 5.4 or higher versions.
200194
201195When you are finished working on your Symfony application, you can stop the
202196server by pressing `Ctrl+C ` from terminal.
@@ -206,7 +200,7 @@ Checking Symfony Application Configuration and Setup
206200
207201Symfony applications come with a visual server configuration tester to show if
208202your environment is ready to use Symfony. Access the following URL to check your
209- configuration::
203+ configuration:
210204
211205.. code-block :: text
212206
@@ -301,7 +295,7 @@ and they are managed exclusively by Composer.
301295
302296Updating those third-party libraries frequently is a good practice to prevent bugs
303297and security vulnerabilities. Execute the ``update `` Composer command to update
304- them all at once::
298+ them all at once:
305299
306300.. code-block :: bash
307301
@@ -311,6 +305,18 @@ them all at once::
311305 Depending on the complexity of your project, this update process can take up to
312306several minutes to complete.
313307
308+ .. tip ::
309+
310+ Symfony provides a command to check whether your project's dependencies
311+ contain any known security vulnerability:
312+
313+ .. code-block :: bash
314+
315+ $ php app/console security:check
316+
317+ A good security practice is to execute this command regularly to be able to
318+ update or replace compromised dependencies as soon as possible.
319+
314320Installing the Symfony Demo Application
315321---------------------------------------
316322
@@ -320,7 +326,7 @@ conceived as a learning tool for Symfony newcomers and its source code contains
320326tons of comments and helpful notes.
321327
322328In order to download the Symfony Demo application, execute the ``demo `` command
323- of the Symfony Installer anywhere in your system::
329+ of the Symfony Installer anywhere in your system:
324330
325331.. code-block :: bash
326332
@@ -344,7 +350,7 @@ Symfony project packages "distributions", which are fully-functional application
344350that include the Symfony core libraries, a selection of useful bundles, a
345351sensible directory structure and some default configuration. In fact, when you
346352created a Symfony application in the previous sections, you actually downloaded the
347- default distribution provided by Symfony, which is called * `Symfony Standard Edition`_ * .
353+ default distribution provided by Symfony, which is called `Symfony Standard Edition `_.
348354
349355The Symfony Standard Edition is by far the most popular distribution and it's
350356also the best choice for developers starting with Symfony. However, the Symfony
@@ -353,25 +359,43 @@ applications:
353359
354360* The `Symfony CMF Standard Edition `_ is the best distribution to get started
355361 with the `Symfony CMF `_ project, which is a project that makes it easier for
356- developers to add ` CMS `_ functionality to applications built with the Symfony
362+ developers to add CMS functionality to applications built with the Symfony
357363 Framework.
358364* The `Symfony REST Edition `_ shows how to build an application that provides a
359365 RESTful API using the `FOSRestBundle `_ and several other related bundles.
360366
361- Configuration Formats
362- ---------------------
367+ Using Source Control
368+ --------------------
369+
370+ If you're using a version control system like `Git `_, you can safely commit all
371+ your project's code. The reason is that Symfony applications already contain a
372+ ``.gitignore `` file specially prepared for Symfony.
373+
374+ For specific instructions on how best to set up your project to be stored
375+ in Git, see :doc: `/cookbook/workflow/new_project_git `.
376+
377+ Checking out a versioned Symfony Application
378+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
379+
380+ When using Composer to manage application's dependencies, it's recommended to
381+ ignore the entire ``vendor/ `` directory before committing its code to the
382+ repository. This means that when checking out a Symfony application from a Git
383+ repository, there will be no ``vendor/ `` directory and the application won't
384+ work out-of-the-box.
363385
364- Symfony supports several configuration formats: YAML, XML and PHP. Throughout
365- the chapters, all configuration examples will be shown in all three formats.
366- Each has its own advantages and disadvantages. The choice of which to use is up
367- to you:
386+ In order to make it work, check out the Symfony application and then execute the
387+ ``install `` Composer command to download and install all the dependencies required
388+ by the application:
368389
369- * *YAML *: Simple, clean and readable (learn more about YAML in the Yaml component
370- documentation :doc: `/components/yaml/yaml_format `);
390+ .. code-block :: bash
371391
372- * *XML *: More powerful than YAML at times and supports IDE autocompletion;
392+ $ cd my_project_name/
393+ $ composer install
373394
374- * *PHP *: Very powerful but less readable than standard configuration formats.
395+ How does Composer know which specific dependencies to install? Because when a
396+ Symfony application is committed to a repository, the ``composer.json `` and
397+ ``composer.lock `` files are also committed. These files tell Composer which
398+ dependencies (and which specific versions) to install for the application.
375399
376400Beginning Development
377401---------------------
@@ -391,13 +415,10 @@ a wide variety of articles about solving specific problems with Symfony.
391415.. _`explained in this post` : http://fabien.potencier.org/signing-project-releases.html
392416.. _`Phar extension` : http://php.net/manual/en/intro.phar.php
393417.. _`Composer` : https://getcomposer.org/
394- .. _`Apache` : http://httpd.apache.org/docs/current/mod/core.html#documentroot
395- .. _`Nginx` : http://wiki.nginx.org/Symfony
396418.. _`enable ACL support` : https://help.ubuntu.com/community/FilePermissionsACLs
397419.. _`Git` : http://git-scm.com/
398420.. _`Symfony Standard Edition` : https://github.com/symfony/symfony-standard
399421.. _`Symfony CMF Standard Edition` : https://github.com/symfony-cmf/symfony-cmf-standard
400422.. _`Symfony CMF` : http://cmf.symfony.com/
401- .. _`CMS` : https://en.wikipedia.org/wiki/Content_management_system
402423.. _`Symfony REST Edition` : https://github.com/gimler/symfony-rest-edition
403424.. _`FOSRestBundle` : https://github.com/FriendsOfSymfony/FOSRestBundle
0 commit comments