@@ -20,40 +20,39 @@ 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
25+ .. code-block :: bash
2626
27- {
28- "require" : {
29- "symfony/finder" : " 2.3.*"
30- }
31- }
27+ $ composer require symfony/finder
3228
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.* ``) .
29+ The name `` symfony/finder `` is written at the top of the documentation for
30+ whatever component you want .
3531
36- You can research the component names and versions at ` packagist.org `_.
32+ .. tip ::
3733
38- **3. ** `Install composer `_ if you don't already have it present on your system:
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 ``.
3938
40- ** 4. ** Download the vendor libraries and generate the `` vendor/autoload.php `` file :
39+ If you know you need a specific version of the library, add that to the command :
4140
4241.. code-block :: bash
4342
44- $ php composer.phar install
43+ $ composer require symfony/finder: ~ 2.3
4544
46- **5 . ** Write your code:
45+ **3 . ** Write your code!
4746
4847Once Composer has downloaded the component(s), all you need to do is include
4948the ``vendor/autoload.php `` file that was generated by Composer. This file
5049takes care of autoloading all of the libraries so that you can use them
5150immediately::
5251
53- // File: src/script.php
52+ // File example : src/script.php
5453
5554 // update this to the path to the "vendor/" directory, relative to this file
56- require_once '../vendor/autoload.php';
55+ require_once __DIR__. '../vendor/autoload.php';
5756
5857 use Symfony\Component\Finder\Finder;
5958
@@ -62,33 +61,18 @@ immediately::
6261
6362 // ...
6463
65- .. tip ::
66-
67- If you want to use all of the Symfony Components, then instead of adding
68- them one by one:
64+ Using all of the Components
65+ ---------------------------
6966
70- .. code-block :: json
67+ If you want to use all of the Symfony Components, then instead of adding
68+ them one by one, you can include the ``symfony/symfony `` package:
7169
72- {
73- "require" : {
74- "symfony/finder" : " 2.3.*" ,
75- "symfony/dom-crawler" : " 2.3.*" ,
76- "symfony/css-selector" : " 2.3.*"
77- }
78- }
79-
80- you can use:
81-
82- .. code-block :: json
70+ .. code-block :: bash
8371
84- {
85- "require" : {
86- "symfony/symfony" : " 2.3.*"
87- }
88- }
72+ $ composer require symfony/symfony
8973
90- This will include the Bundle and Bridge libraries, which you may not
91- actually need.
74+ This will also include the Bundle and Bridge libraries, which you may or
75+ may not actually need.
9276
9377Now what?
9478---------
@@ -100,4 +84,3 @@ And have fun!
10084
10185.. _Composer : http://getcomposer.org
10286.. _Install composer : http://getcomposer.org/download/
103- .. _packagist.org : https://packagist.org/
0 commit comments