1
1
.. index ::
2
- single: Workflow; Components
2
+ single: Components; Installation
3
+ single: Components; Usage
3
4
4
- How to start a new project using the Symfony2 Components
5
- ========================================================
5
+ How to Install and Use the Symfony2 Components
6
+ ==============================================
6
7
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.
8
+ If you're starting a new project (or already have a project) that will use
9
+ one or more components, the easiest way to integrate everything is with Composer.
10
+ Composer is smart enough to download the component(s) that you need and take
11
+ care of autoloading so that you can begin using the libraries immediately.
12
12
13
13
This article will take you through using the :doc: `/components/finder `, though
14
14
this applies to using any component.
15
15
16
- Using Finder Component
17
- ----------------------
16
+ Using the Finder Component
17
+ --------------------------
18
18
19
- **1. ** Create a new empty directory for your project .
19
+ **1. ** If you're creating a new project, create a new empty directory for it .
20
20
21
21
**2. ** Create a new file called ``composer.json `` and paste the following into it:
22
22
@@ -31,15 +31,15 @@ Using Finder Component
31
31
If you already have a ``composer.json `` file, just add this line to it. You
32
32
may also need to adjust the version (e.g. ``2.1.1 `` or ``2.2.* ``).
33
33
34
- You can research the component names and versions at _packagist .org.
34
+ You can research the component names and versions at ` packagist .org`_ .
35
35
36
36
**3. ** Download the vendor libraries and generate the ``vendor/autoload.php `` file:
37
37
38
38
.. code-block :: bash
39
39
40
40
$ php composer.phar install
41
41
42
- 4. Write your code:
42
+ ** 4. ** Write your code:
43
43
44
44
Once Composer has downloaded the component(s), all you need to do is include
45
45
the ``vendor/autoload.php `` file that was generated by Composer. This file
@@ -69,7 +69,6 @@ immediately::
69
69
"symfony/finder" : " 2.1.*" ,
70
70
"symfony/dom-crawler" : " 2.1.*" ,
71
71
"symfony/css-selector" : " 2.1.*"
72
- ...
73
72
}
74
73
}
75
74
@@ -86,4 +85,12 @@ immediately::
86
85
This will include the Bundle and Bridge libraries, which you may not
87
86
actually need.
88
87
88
+ Now What?
89
+ ---------
90
+
91
+ Now that the component is installed and autoloaded, read the specific component's
92
+ documentation to find out more about how to use it.
93
+
94
+ And have fun!
95
+
89
96
.. _packagist.org : https://packagist.org/
0 commit comments