Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Rebased Quick Tour Refactoring #3612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a84a556
[quick_tour] simplified drastically the first two sections of "The Bi…
javiereguiluz Jan 30, 2014
29992cd
[quick_tour] simplified the "routing" section
javiereguiluz Jan 31, 2014
20e9fb0
[quick_tour] updated the "Controllers" section
javiereguiluz Jan 31, 2014
f24eabc
[quick_tour] updated some screenshots
javiereguiluz Jan 31, 2014
5b3a572
[quick_tour] finished the review of "The Big Picture" chapter
javiereguiluz Jan 31, 2014
dbbc8c2
[quick_tour] updated "the view" chapter
javiereguiluz Feb 1, 2014
eb3fe4c
[quick tour] simplified "the controller" chapter
javiereguiluz Feb 1, 2014
e7dfc8b
[quick_tour] simplified "the architecture" chapter
javiereguiluz Feb 1, 2014
4ad3c44
[quick_tour] second pass to the "big picture" chapter
javiereguiluz Feb 3, 2014
2cd3bab
[quick tour] second pass to "the view" chapter
javiereguiluz Feb 3, 2014
cdb7064
[quick_tour] second pass to "the controller" chapter and
javiereguiluz Feb 4, 2014
50e136c
[quick_tour] second pass to "the architecture" chapter
javiereguiluz Feb 4, 2014
81d6e20
[quick_tour] replaced "chapter" by "part" in some tutorial parts
javiereguiluz Feb 4, 2014
38b1292
[quick_tour] removed inline links
javiereguiluz Feb 9, 2014
e004661
Bundle names should not be placed in literals
javiereguiluz Feb 9, 2014
6afc80b
Removed a wrongly inserted comma
javiereguiluz Feb 9, 2014
2fdcffd
When using server:run command, it's not necessary to add the `app_dev…
javiereguiluz Feb 9, 2014
b16c3a2
Capitalized some sentences that come after a colon
javiereguiluz Feb 9, 2014
c1ad15d
Added a new headline to better structure the documentation
javiereguiluz Feb 9, 2014
75be815
Minor rewording
javiereguiluz Feb 9, 2014
42bd69f
Fixed the capitalization of a section heading
javiereguiluz Feb 9, 2014
985c68f
Replaced "variable" by "placeholder" when using {_format} inside a route
javiereguiluz Feb 9, 2014
a013b11
Removed the animated GIF showing how to install Symfony
javiereguiluz Feb 9, 2014
eca1e73
Added a more useful message for users that don't have PHP 5.4
javiereguiluz Feb 16, 2014
fdc755e
Grammar fixes proposed by @weaverryan and @WouterJ
javiereguiluz Feb 16, 2014
cb98a6c
Restored the original line that explained how a routing file is imported
javiereguiluz Feb 16, 2014
7c0037e
Restored all the original introductions for each tutorial part
javiereguiluz Feb 16, 2014
0f13ce9
[quick_tour] rewording and grammar fixes suggested by @weaverryan
javiereguiluz Feb 18, 2014
30624eb
[quick_tour] more rewording and grammar fixes
javiereguiluz Feb 18, 2014
69fdff1
[quick_tour] removed an unneeded comma
javiereguiluz Feb 18, 2014
1e36cfa
[quick_tour] rewording and grammar fixes noted by @xabbuh
javiereguiluz Feb 19, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[quick_tour] simplified drastically the first two sections of "The Bi…
…g Picture" chapter
  • Loading branch information
javiereguiluz authored and weaverryan committed Feb 26, 2014
commit a84a556745839f3709d382026b82e8266a4a284b
Binary file added BIN +404 KB images/quick_tour/install_symfony2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +99.3 KB images/quick_tour/symfony2_welcome_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
177 changes: 57 additions & 120 deletions 177 quick_tour/the_big_picture.rst
Original file line number Diff line number Diff line change
@@ -1,157 +1,94 @@
The Big Picture
===============

Start using Symfony2 in 10 minutes! This chapter will walk you through some
of the most important concepts behind Symfony2 and explain how you can get
started quickly by showing you a simple project in action.
This chapter will teach you how to develop a simple Symfony2 project in 10
minutes! If you've used a web framework before, you should feel right at home
with Symfony2. If not, welcome to a whole new way of developing web applications.

If you've used a web framework before, you should feel right at home with
Symfony2. If not, welcome to a whole new way of developing web applications!
Installing Symfony2
-------------------

.. tip::

Want to learn why and when you need to use a framework? Read the "`Symfony
in 5 minutes`_" document.

Downloading Symfony2
--------------------

First, check that you have installed and configured a Web server (such as
Apache) with PHP 5.3.3 or higher.

.. tip::

If you have PHP 5.4, you could use the built-in web server to start trying
things out. We'll tell you how to start the built-in web server
:ref:`after downloading Symfony<quick-tour-big-picture-built-in-server>`.

Ready? Start by downloading the "`Symfony2 Standard Edition`_": a Symfony
:term:`distribution` that is preconfigured for the most common use cases and
also contains some code that demonstrates how to use Symfony2 (get the archive
with the *vendors* included to get started even faster).

After unpacking the archive under your web server root directory (if you'll
use the built-in PHP web server, you can unpack it anywhere), you should
have a ``Symfony/`` directory that looks like this:
First, check that the PHP version installed on your computer meets the Symfony2
requirements: 5.3.3 or higher. Then, open a command console and execute the
following command to install the latest version of Symfony2 in the ``myproject/``
directory:

.. code-block:: text
.. code-block:: bash

www/ <- your web root directory
Symfony/ <- the unpacked archive
app/
cache/
config/
logs/
Resources/
bin/
src/
Acme/
DemoBundle/
Controller/
Resources/
...
vendor/
symfony/
doctrine/
...
web/
app.php
...
$ composer create-project symfony/framework-standard-edition myproject/ ~2.4

.. note::

If you are familiar with `Composer`_, you can download Composer and then
run the following command instead of downloading the archive (replacing
``2.3.0`` with the latest Symfony release like ``2.3.1``):
`Composer <https://getcomposer.org/>` is the package manager used by modern
PHP applications and the only recommended way to install Symfony2. To
install Composer on your Linux or Mac system, execute the following commands:

.. code-block:: bash

$ php composer.phar create-project symfony/framework-standard-edition Symfony 2.3.0

.. _`quick-tour-big-picture-built-in-server`:

If you have PHP 5.4, you can use the built-in web server:

.. code-block:: bash

# check your PHP CLI configuration
$ php app/check.php

# run the built-in web server
$ php app/console server:run

Then the URL to your application will be "http://localhost:8000/app_dev.php"

The built-in server should be used only for development purpose, but it
can help you to start your project quickly and easily.
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

If you're using a traditional web server like Apache, your URL depends on
your configuration. If you've unzipped Symfony under your web root into a
``Symfony`` directory, then the URL to your application will be:
"http://localhost/Symfony/web/app_dev.php".

.. note::
To install Composer on a Windows system, download the executable installer
from `getcomposer.org/download <http://getcomposer.org/download>`.

Read more in our :doc:`/cookbook/configuration/web_server_configuration`
section.
Beware that the first time you install Symfony2, it may take a few minutes to
download all its components. At the end of the installation process, the
installer will ask you to provide some configuration options for the Symfony2
project. For this first project you can safely ignore this configuration by
pressing the ``<Enter>`` key repeatedly.

Checking the Configuration
--------------------------

Symfony2 comes with a visual server configuration tester to help avoid some
headaches that come from Web server or PHP misconfiguration. Use the following
URL to see the diagnostics for your machine:
.. The following GIF is only useful if the user can "click" on it
.. to activate the animation. Otherwise, it shouldn't be included
.. because it's too long and it doesn't make sense to see it half-started.
.. image:: /images/quick_tour/installing_symfony2.gif
:align: center
:alt: Installing Symfony2 on the command console

.. code-block:: text
Running Symfony2
----------------

http://localhost/config.php
Before running Symfony2 for the first time, execute the following command to
make sure that your system meets all the technical requirements:

.. note::
.. code-block:: bash

All of the example URLs assume you've setup your web server to point
directly to the ``web/`` directory of your new project, which is different
and a bit more advanced than the process shown above. So, the URL on your
machine will vary - e.g. ``http://localhost:8000/config.php``
or ``http://localhost/Symfony/web/config.php``. See the
:ref:`above section<quick-tour-big-picture-built-in-server>` for details
on what your URL should be and use it below in all of the examples.
$ cd myproject/
$ php app/check.php

If there are any outstanding issues listed, correct them. You might also tweak
your configuration by following any given recommendations. When everything is
fine, click on "*Bypass configuration and go to the Welcome page*" to request
your first "real" Symfony2 webpage:
Fix any error reported by the command and then, use the PHP built-in web server
to run Symfony:

.. code-block:: text
.. code-block:: bash

http://localhost/app_dev.php/
$ php app/console server:run

Symfony2 should welcome and congratulate you for your hard work so far!
Open your browser and access to the ``http://localhost:8000/`` URL to see the
Welcome page of Symfony2:

.. image:: /images/quick_tour/welcome.png
.. image:: /images/quick_tour/symfony2_welcome_page.png
:align: center
:alt: Symfony2 Welcome Page

The built-in web server is available for PHP 5.4.0 or higher. If you have an
older version of PHP or if you prefer a traditional web server such as Apache
or Nginx, read the :doc:`/cookbook/configuration/web_server_configuration`
article.

Understanding the Fundamentals
------------------------------

One of the main goals of a framework is to ensure `Separation of Concerns`_.
This keeps your code organized and allows your application to evolve easily
over time by avoiding the mixing of database calls, HTML tags, and business
logic in the same script. To achieve this goal with Symfony, you'll first
need to learn a few fundamental concepts and terms.

.. tip::

Want proof that using a framework is better than mixing everything
in the same script? Read the ":doc:`/book/from_flat_php_to_symfony2`"
chapter of the book.
One of the main goals of a framework is to keep your code organized and allow
your application to evolve easily over time by avoiding the mixing of database
calls, HTML tags, and business logic in the same script. To achieve this goal
with Symfony, you'll first need to learn a few fundamental concepts and terms.

The distribution comes with some sample code that you can use to learn more
about the main Symfony2 concepts. Go to the following URL to be greeted by
Symfony2 (replace *Fabien* with your first name):
Symfony comes with some sample code that you can use to learn more about its
main concepts. Go to the following URL to be greeted by Symfony2 (replace
*Fabien* with your first name):

.. code-block:: text

http://localhost/app_dev.php/demo/hello/Fabien
http://localhost:8000/app_dev.php/demo/hello/Fabien

.. image:: /images/quick_tour/hello_fabien.png
:align: center
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.