@@ -20,40 +20,33 @@ Using the Finder Component
20
20
21
21
**1. ** If you're creating a new project, create a new empty directory for it.
22
22
23
- **2. ** Create a new file called `` composer.json `` and paste the following into it:
23
+ **2. ** Open a terminal and use Composer to grab the library.
24
24
25
- .. code-block :: json
26
-
27
- {
28
- "require" : {
29
- "symfony/finder" : " 2.3.*"
30
- }
31
- }
32
-
33
- If you already have a ``composer.json `` file, just add this line to it. You
34
- may also need to adjust the version (e.g. ``2.2.2 `` or ``2.3.* ``).
35
-
36
- You can research the component names and versions at `packagist.org `_.
25
+ .. code-block :: bash
37
26
38
- ** 3. ** ` Install composer `_ if you don't already have it present on your system:
27
+ $ composer require symfony/finder
39
28
40
- **4. ** Download the vendor libraries and generate the ``vendor/autoload.php `` file:
29
+ The name ``symfony/finder `` is written at the top of the documentation for
30
+ whatever component you want.
41
31
42
- .. code-block :: bash
32
+ .. tip ::
43
33
44
- $ php composer.phar install
34
+ If you get a command not found for ``composer ``, you'll need to
35
+ `Install composer `_. Depending on how you install, you may end up with
36
+ a ``composer.phar `` file in your directory. In that case, no worries!
37
+ Just run ``php composer.phar require symfony/finder ``.
45
38
46
- **5 . ** Write your code:
39
+ **3 . ** Write your code!
47
40
48
41
Once Composer has downloaded the component(s), all you need to do is include
49
42
the ``vendor/autoload.php `` file that was generated by Composer. This file
50
43
takes care of autoloading all of the libraries so that you can use them
51
44
immediately::
52
45
53
- // File: src/script.php
46
+ // File example : src/script.php
54
47
55
48
// update this to the path to the "vendor/" directory, relative to this file
56
- require_once '../vendor/autoload.php';
49
+ require_once __DIR__. '../vendor/autoload.php';
57
50
58
51
use Symfony\Component\Finder\Finder;
59
52
@@ -62,33 +55,18 @@ immediately::
62
55
63
56
// ...
64
57
65
- .. tip ::
66
-
67
- If you want to use all of the Symfony Components, then instead of adding
68
- them one by one:
69
-
70
- .. code-block :: json
58
+ Using all of the Components
59
+ ---------------------------
71
60
72
- {
73
- "require" : {
74
- "symfony/finder" : " 2.3.*" ,
75
- "symfony/dom-crawler" : " 2.3.*" ,
76
- "symfony/css-selector" : " 2.3.*"
77
- }
78
- }
61
+ If you want to use all of the Symfony Components, then instead of adding
62
+ them one by one, you can include the ``symfony/symfony `` package:
79
63
80
- you can use:
81
-
82
- .. code-block :: json
64
+ .. code-block :: bash
83
65
84
- {
85
- "require" : {
86
- "symfony/symfony" : " 2.3.*"
87
- }
88
- }
66
+ $ composer require symfony/symfony
89
67
90
- This will include the Bundle and Bridge libraries, which you may not
91
- actually need.
68
+ This will also include the Bundle and Bridge libraries, which you may or
69
+ may not actually need.
92
70
93
71
Now what?
94
72
---------
@@ -100,4 +78,3 @@ And have fun!
100
78
101
79
.. _Composer : http://getcomposer.org
102
80
.. _Install composer : http://getcomposer.org/download/
103
- .. _packagist.org : https://packagist.org/
0 commit comments