@@ -20,40 +20,33 @@ Using the Finder Component
2020
2121**1. ** If you're creating a new project, create a new empty directory for it.
2222
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.
2424
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
3726
38- ** 3. ** ` Install composer `_ if you don't already have it present on your system:
27+ $ composer require symfony/finder
3928
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.
4131
42- .. code-block :: bash
32+ .. tip ::
4333
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 ``.
4538
46- **5 . ** Write your code:
39+ **3 . ** Write your code!
4740
4841Once Composer has downloaded the component(s), all you need to do is include
4942the ``vendor/autoload.php `` file that was generated by Composer. This file
5043takes care of autoloading all of the libraries so that you can use them
5144immediately::
5245
53- // File: src/script.php
46+ // File example : src/script.php
5447
5548 // 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';
5750
5851 use Symfony\Component\Finder\Finder;
5952
@@ -62,33 +55,18 @@ immediately::
6255
6356 // ...
6457
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+ ---------------------------
7160
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:
7963
80- you can use:
81-
82- .. code-block :: json
64+ .. code-block :: bash
8365
84- {
85- "require" : {
86- "symfony/symfony" : " 2.3.*"
87- }
88- }
66+ $ composer require symfony/symfony
8967
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.
9270
9371Now what?
9472---------
@@ -100,4 +78,3 @@ And have fun!
10078
10179.. _Composer : http://getcomposer.org
10280.. _Install composer : http://getcomposer.org/download/
103- .. _packagist.org : https://packagist.org/
0 commit comments