File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
new_project_git
8
8
new_project_svn
9
+ new_project_components
Original file line number Diff line number Diff line change
1
+ .. index ::
2
+ single: Workflow; Components
3
+
4
+ How to start a new project using Symfony2 Components
5
+ ====================================================
6
+
7
+ Using Finder Component
8
+ ----------------------
9
+
10
+ 1. Create a new empty folder.
11
+
12
+ 2. Create a new file called ``composer.json `` and paste the following into it:
13
+
14
+ .. code-block :: json
15
+
16
+ {
17
+ "require" : {
18
+ "symfony/finder" : " 2.1.*"
19
+ }
20
+ }
21
+
22
+ 3. Download vendor libraries and generate ``vendor/autoload.php `` file:
23
+
24
+ .. code-block :: bash
25
+
26
+ $ php composer.phar install
27
+
28
+ 4. Write your code:
29
+
30
+ .. code-block :: php
31
+
32
+ <?php
33
+
34
+ // File: src/script.php
35
+
36
+ require_once '../vendor/autoload.php';
37
+
38
+ use Symfony\Component\Finder\Finder;
39
+
40
+ $finder = new Finder();
41
+ $finder->in('../data/');
42
+
43
+ ...
44
+
45
+ .. tip ::
46
+
47
+ If you want to use all the Symfony2 Component, then instead of adding them one by one:
48
+
49
+ .. code-block :: json
50
+
51
+ {
52
+ "require" : {
53
+ "symfony/finder" : " 2.1.*" ,
54
+ "symfony/dom-crawler" : " 2.1.*" ,
55
+ "symfony/css-selector" : " 2.1.*"
56
+ ...
57
+ }
58
+ }
59
+
60
+ use:
61
+
62
+ .. code-block :: json
63
+
64
+ {
65
+ "require" : {
66
+ "symfony/symfony" : " 2.1.*"
67
+ }
68
+ }
You can’t perform that action at this time.
0 commit comments