Skip to content

Commit 2593382

Browse files
committed
[WIP] More changes
1 parent a955b5c commit 2593382

File tree

2 files changed

+63
-47
lines changed

2 files changed

+63
-47
lines changed

book/installation.rst

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ways.
2828
Linux 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.
4040
Windows 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
@@ -58,7 +58,7 @@ Creating the Symfony Application
5858
--------------------------------
5959

6060
Once the Symfony Installer is available, create your first Symfony application
61-
with the ``new`` command::
61+
with the ``new`` command:
6262

6363
.. code-block:: bash
6464
@@ -90,7 +90,7 @@ Basing your Project on a Specific Symfony Version
9090
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9191

9292
In case your project needs to be based on a specific Symfony version, use the
93-
optional second argument of the ``new`` command::
93+
optional second argument of the ``new`` command:
9494

9595
.. code-block:: bash
9696
@@ -107,7 +107,7 @@ optional second argument of the ``new`` command::
107107
$ symfony new my_project 2.7.0-RC1
108108
109109
The installer also supports a special version called ``lts`` which installs the
110-
most recent :ref:`Symfony LTS version <releases-lts>` available::
110+
most recent :ref:`Symfony LTS version <releases-lts>` available:
111111

112112
.. code-block:: bash
113113
@@ -139,14 +139,14 @@ Creating a Symfony Application with Composer
139139
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140140

141141
Once Composer is installed on your computer, execute the ``create-project`` Composer
142-
command to create a new Symfony application based on its latest stable version::
142+
command to create a new Symfony application based on its latest stable version:
143143

144144
.. code-block:: bash
145145
146146
$ composer create-project symfony/framework-standard-edition my_project_name
147147
148148
If you need to base your application on a specific Symfony version, provide that
149-
version as the second argument of the ``create-project`` Composer command::
149+
version as the second argument of the ``create-project`` Composer command:
150150

151151
.. code-block:: bash
152152
@@ -158,14 +158,12 @@ version as the second argument of the ``create-project`` Composer command::
158158
doing anything. If that's your case, add the ``-vvv`` flag to the previous
159159
command to display a detailed output of everything that Composer is doing.
160160

161-
$ composer create-project -vvv symfony/framework-standard-edition my_project_name "2.3.*"
162-
163161
Running the Symfony Application
164162
-------------------------------
165163

166164
Symfony leverages the internal web server provided by PHP to run applications
167165
while developing them. Therefore, running a Symfony application is a matter of
168-
browsing the project directory and executing this command::
166+
browsing the project directory and executing this command:
169167

170168
.. code-block:: bash
171169
@@ -185,16 +183,12 @@ possible solutions depending on your operating system. All of them are
185183
explained in the :ref:`Setting up Permissions <book-installation-permissions>`
186184
section of this chapter.
187185

188-
Using PHP's internal web server is only suitable while developing the application.
189-
In order to run Symfony applications on production servers, you'll have to
190-
configure your `Apache`_ or `Nginx`_ web server and virtual host as explained in
191-
cookbook article :doc:`/cookbook/configuration/web_server_configuration`.
186+
PHP's internal web server is great for developing, but should **not** be used on
187+
production. Instead, use Apache or Nginx. See :doc:`/cookbook/configuration/web_server_configuration`.
192188

193189
.. note::
194190

195-
PHP's internal web server is available in PHP 5.4 or higher versions. So, if you
196-
still use the legacy PHP 5.3 version, you'll also have to configure `Apache`_ or
197-
`Nginx`_ web server and virtual host.
191+
PHP's internal web server is available in PHP 5.4 or higher versions.
198192

199193
When you are finished working on your Symfony application, you can stop the
200194
server by pressing `Ctrl+C` from terminal.
@@ -204,7 +198,7 @@ Checking Symfony Application Configuration and Setup
204198

205199
Symfony applications come with a visual server configuration tester to show if
206200
your environment is ready to use Symfony. Access the following URL to check your
207-
configuration::
201+
configuration:
208202

209203
.. code-block:: text
210204
@@ -299,7 +293,7 @@ and they are managed exclusively by Composer.
299293

300294
Updating those third-party libraries frequently is a good practice to prevent bugs
301295
and security vulnerabilities. Execute the ``update`` Composer command to update
302-
them all at once::
296+
them all at once:
303297

304298
.. code-block:: bash
305299
@@ -309,6 +303,18 @@ them all at once::
309303
Depending on the complexity of your project, this update process can take up to
310304
several minutes to complete.
311305

306+
.. tip::
307+
308+
Symfony provides a command to check whether your project's dependencies
309+
contain any known security vulnerability:
310+
311+
.. code-block:: bash
312+
313+
$ php app/console security:check
314+
315+
A good security practice is to execute this command regularly to be able to
316+
update or replace compromised dependencies as soon as possible.
317+
312318
Installing the Symfony Demo Application
313319
---------------------------------------
314320

@@ -318,7 +324,7 @@ conceived as a learning tool for Symfony newcomers and its source code contains
318324
tons of comments and helpful notes.
319325

320326
In order to download the Symfony Demo application, execute the ``demo`` command
321-
of the Symfony Installer anywhere in your system::
327+
of the Symfony Installer anywhere in your system:
322328

323329
.. code-block:: bash
324330
@@ -342,7 +348,7 @@ Symfony project packages "distributions", which are fully-functional application
342348
that include the Symfony core libraries, a selection of useful bundles, a
343349
sensible directory structure and some default configuration. In fact, when you
344350
created a Symfony application in the previous sections, you actually downloaded the
345-
default distribution provided by Symfony, which is called *`Symfony Standard Edition`_*.
351+
default distribution provided by Symfony, which is called `Symfony Standard Edition`_.
346352

347353
The Symfony Standard Edition is by far the most popular distribution and it's
348354
also the best choice for developers starting with Symfony. However, the Symfony
@@ -351,25 +357,43 @@ applications:
351357

352358
* The `Symfony CMF Standard Edition`_ is the best distribution to get started
353359
with the `Symfony CMF`_ project, which is a project that makes it easier for
354-
developers to add `CMS`_ functionality to applications built with the Symfony
360+
developers to add CMS functionality to applications built with the Symfony
355361
Framework.
356362
* The `Symfony REST Edition`_ shows how to build an application that provides a
357363
RESTful API using the `FOSRestBundle`_ and several other related bundles.
358364

359-
Configuration Formats
360-
---------------------
365+
Using Source Control
366+
--------------------
367+
368+
If you're using a version control system like `Git`_, you can safely commit all
369+
your project's code. The reason is that Symfony applications already contain a
370+
``.gitignore`` file specially prepared for Symfony.
371+
372+
For specific instructions on how best to set up your project to be stored
373+
in Git, see :doc:`/cookbook/workflow/new_project_git`.
374+
375+
Checking out a versioned Symfony Application
376+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
377+
378+
When using Composer to manage application's dependencies, it's recommended to
379+
ignore the entire ``vendor/`` directory before committing its code to the
380+
repository. This means that when checking out a Symfony application from a Git
381+
repository, there will be no ``vendor/`` directory and the application won't
382+
work out-of-the-box.
361383

362-
Symfony supports several configuration formats: YAML, XML and PHP. Throughout
363-
the chapters, all configuration examples will be shown in all three formats.
364-
Each has its own advantages and disadvantages. The choice of which to use is up
365-
to you:
384+
In order to make it work, check out the Symfony application and then execute the
385+
``install`` Composer command to download and install all the dependencies required
386+
by the application:
366387

367-
* *YAML*: Simple, clean and readable (learn more about YAML in the Yaml component
368-
documentation :doc:`/components/yaml/yaml_format`);
388+
.. code-block:: bash
369389
370-
* *XML*: More powerful than YAML at times and supports IDE autocompletion;
390+
$ cd my_project_name/
391+
$ composer install
371392
372-
* *PHP*: Very powerful but less readable than standard configuration formats.
393+
How does Composer know which specific dependencies to install? Because when a
394+
Symfony application is committed to a repository, the ``composer.json`` and
395+
``composer.lock`` files are also committed. These files tell Composer which
396+
dependencies (and which specific versions) to install for the application.
373397

374398
Beginning Development
375399
---------------------
@@ -389,13 +413,10 @@ a wide variety of articles about solving specific problems with Symfony.
389413
.. _`explained in this post`: http://fabien.potencier.org/signing-project-releases.html
390414
.. _`Phar extension`: http://php.net/manual/en/intro.phar.php
391415
.. _`Composer`: https://getcomposer.org/
392-
.. _`Apache`: http://httpd.apache.org/docs/current/mod/core.html#documentroot
393-
.. _`Nginx`: http://wiki.nginx.org/Symfony
394416
.. _`enable ACL support`: https://help.ubuntu.com/community/FilePermissionsACLs
395417
.. _`Git`: http://git-scm.com/
396418
.. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard
397419
.. _`Symfony CMF Standard Edition`: https://github.com/symfony-cmf/symfony-cmf-standard
398420
.. _`Symfony CMF`: http://cmf.symfony.com/
399-
.. _`CMS`: https://en.wikipedia.org/wiki/Content_management_system
400421
.. _`Symfony REST Edition`: https://github.com/gimler/symfony-rest-edition
401422
.. _`FOSRestBundle`: https://github.com/FriendsOfSymfony/FOSRestBundle

book/page_creation.rst

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ simple two-step process:
1313
#. *Create a route*: A route is the URL (e.g. ``/about``) to your page and
1414
points to a controller;
1515

16-
#. *Create a controller*: A :term:`controller` is the PHP function you write that
16+
#. *Create a controller*: A controller is the PHP function you write that
1717
builds the page. You take the incoming request information and use it to
1818
create a Symfony ``Response`` object, which can hold HTML content, a JSON
1919
string or even a binary file like an image or PDF. The only rule is that
@@ -24,21 +24,16 @@ simple two-step process:
2424
Just like on the web, every interaction is initiated by an HTTP request.
2525
Your job is pure and simple: understand that request and return a response.
2626

27+
.. index::
28+
single:: Page creation; Example
29+
2730
Creating a Page: Route and Controller
2831
-------------------------------------
2932

3033
.. tip::
3134

32-
Before continuing, make sure you've read the
33-
:doc:`Installation </book/installation>` chapter, installed
34-
`Symfony Standard Edition`_ and can access your new Symfony app in the
35-
browser either using PHP's internal web server or by setting proper
36-
virtual host in Apache or Nginx.
37-
38-
Using PHP's internal web server is only suitable while developing the
39-
application. In order to run Symfony applications on production servers,
40-
you'll have to configure your Apache or Nginx web server and virtual
41-
host as explained in :doc:`/cookbook/configuration/web_server_configuration`.
35+
Before continuing, make sure you've read the :doc:`Installation </book/installation>`
36+
chapter and can access your new Symfony app in the browser.
4237

4338
Suppose you want to create a page ``/lucky/number`` that generates a lucky (well,
4439
random) number and prints it. To do that, create a "Controller class" and a

0 commit comments

Comments
 (0)