Skip to content

Commit 37550da

Browse files
committed
[symfony#1899] Proofreading the new document about starting a project with components
1 parent de1e7db commit 37550da

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

cookbook/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,6 @@
145145

146146
* :doc:`/cookbook/workflow/new_project_git`
147147
* :doc:`/cookbook/workflow/new_project_svn`
148+
* :doc:`/cookbook/workflow/new_project_components`
148149

149150
* :doc:`/cookbook/deployment-tools`
Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,50 @@
11
.. index::
22
single: Workflow; Components
33

4-
How to start a new project using Symfony2 Components
5-
====================================================
4+
How to start a new project using the Symfony2 Components
5+
========================================================
6+
7+
If you're starting a new project that uses one or more Symfony2 components
8+
(or adding the components to an existing project), the easiest way to integrate
9+
everything is with Composer. Composer is smart enough to download the component(s)
10+
that you need and take care of autoloading so that you can begin using the
11+
libraries immediately.
12+
13+
This article will take you through using the :doc:`/components/finder`, though
14+
this applies to using any component.
615

716
Using Finder Component
817
----------------------
918

10-
1. Create a new empty folder.
19+
**1.** Create a new empty directory for your project.
1120

12-
2. Create a new file called ``composer.json`` and paste the following into it:
21+
**2.** Create a new file called ``composer.json`` and paste the following into it:
1322

14-
.. code-block:: json
23+
.. code-block:: json
1524
16-
{
17-
"require": {
18-
"symfony/finder": "2.1.*"
19-
}
25+
{
26+
"require": {
27+
"symfony/finder": "2.1.*"
2028
}
29+
}
2130
22-
3. Download vendor libraries and generate ``vendor/autoload.php`` file:
31+
If you already have a ``composer.json`` file, just add this line to it. You
32+
may also need to adjust the version (e.g. ``2.1.1`` or ``2.2.*``).
2333

24-
.. code-block:: bash
34+
You can research the component names and versions at _packagist.org.
2535

26-
$ php composer.phar install
36+
**3.** Download the vendor libraries and generate the ``vendor/autoload.php`` file:
2737

28-
4. Write your code:
38+
.. code-block:: bash
2939
30-
.. code-block:: php
40+
$ php composer.phar install
3141
32-
<?php
42+
4. Write your code:
43+
44+
Once Composer has downloaded the component(s), all you need to do is include
45+
the ``vendor/autoload.php`` file that was generated by Composer. This file
46+
takes care of autoloading all of the libraries so that you can use them
47+
immediately::
3348

3449
// File: src/script.php
3550

@@ -44,7 +59,8 @@ Using Finder Component
4459

4560
.. tip::
4661

47-
If you want to use all the Symfony2 Component, then instead of adding them one by one:
62+
If you want to use all of the Symfony2 Components, then instead of adding
63+
them one by one:
4864

4965
.. code-block:: json
5066
@@ -57,7 +73,7 @@ Using Finder Component
5773
}
5874
}
5975
60-
use:
76+
you can use:
6177

6278
.. code-block:: json
6379
@@ -66,3 +82,8 @@ Using Finder Component
6682
"symfony/symfony": "2.1.*"
6783
}
6884
}
85+
86+
This will include the Bundle and Bridge libraries, which you may not
87+
actually need.
88+
89+
.. _packagist.org: https://packagist.org/

0 commit comments

Comments
 (0)