Skip to content

Commit 1297c75

Browse files
committed
[WIP] More changes
1 parent 47ffb4e commit 1297c75

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
@@ -60,7 +60,7 @@ Creating the Symfony Application
6060
--------------------------------
6161

6262
Once 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

9494
In 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

143143
Once 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-
165163
Running the Symfony Application
166164
-------------------------------
167165

168166
Symfony leverages the internal web server provided by PHP to run applications
169167
while 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
187185
explained in the :ref:`Setting up Permissions <book-installation-permissions>`
188186
section 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

201195
When you are finished working on your Symfony application, you can stop the
202196
server by pressing `Ctrl+C` from terminal.
@@ -206,7 +200,7 @@ Checking Symfony Application Configuration and Setup
206200

207201
Symfony applications come with a visual server configuration tester to show if
208202
your 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

302296
Updating those third-party libraries frequently is a good practice to prevent bugs
303297
and 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
312306
several 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+
314320
Installing the Symfony Demo Application
315321
---------------------------------------
316322

@@ -320,7 +326,7 @@ conceived as a learning tool for Symfony newcomers and its source code contains
320326
tons of comments and helpful notes.
321327

322328
In 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
344350
that include the Symfony core libraries, a selection of useful bundles, a
345351
sensible directory structure and some default configuration. In fact, when you
346352
created 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

349355
The Symfony Standard Edition is by far the most popular distribution and it's
350356
also 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

376400
Beginning 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

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)