Skip to content

Commit fe7696b

Browse files
committed
Merge pull request #4 from phansys/composer_improvements
[Install] Some updates
2 parents 20889dc + 722b9bc commit fe7696b

File tree

4 files changed

+44
-526
lines changed

4 files changed

+44
-526
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor/
22
*.phpunit.xml
3+
composer.lock

README.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You can install the Doctrine Coding Standard as a plugin into your global system
1717

1818
```bash
1919
$ cd /path/to/phpcs/CodeSniffer/Standards
20-
$ git clone https://github.com/doctrine/coding-standard.git Doctrine
20+
$ php composer create-project doctrine/coding-standard Doctrine ~0.1@dev
2121
```
2222

2323
Then you can use it like
@@ -41,32 +41,53 @@ And just sniff a particular file with
4141
$ phpcs /path/to/some/file/to/sniff.php
4242
```
4343

44-
### 2. Custom installation
44+
### 2. Global installation
45+
46+
You also can install the Doctrine Coding Standard globally:
47+
48+
```bash
49+
$ php composer global require doctrine/coding-standard:~0.1@dev
50+
```
51+
52+
Then you can use it like:
53+
54+
```bash
55+
$ phpcs --standard=~/.composer/vendor/doctrine/coding-standard/Doctrine /path/to/some/file/to/sniff.php
56+
```
57+
58+
Or even set it as default standard:
59+
60+
```bash
61+
$ phpcs --config-set default_standard ~/.composer/vendor/doctrine/coding-standard/Doctrine
62+
```
63+
64+
And just sniff a particular file with:
65+
66+
```bash
67+
$ phpcs /path/to/some/file/to/sniff.php
68+
```
69+
70+
### 3. Custom installation
4571

4672
You can install the Doctrine Coding Standard anywhere you want:
4773

4874
```bash
49-
$ cd /path/to/whatever/directory/you/want
50-
$ git clone https://github.com/doctrine/coding-standard.git Doctrine
75+
$ php composer create-project doctrine/coding-standard /path/to/coding-standard/Doctrine ~0.1@dev
5176
```
5277

53-
Then you can use it like (assuming that you have the `phpcs` binary in your search path):
78+
Then you can use it like:
5479

5580
```bash
56-
$ phpcs --standard=/path/to/whatever/directory/you/want/Doctrine /path/to/some/file/to/sniff.php
81+
$ ./vendor/bin/phpcs --standard=. /path/to/some/file/to/sniff.php
5782
```
5883

59-
### 3. As a composer dependency of your project
84+
### 4. As a composer dependency of your project
6085

6186
You can install the Doctrine Coding Standard as a composer dependency to your particular project.
6287
Just add the following block to your project's `composer.json` file:
6388

64-
```js
65-
{
66-
"require": {
67-
"doctrine/coding-standard": "dev-master"
68-
}
69-
}
89+
```bash
90+
$ php composer require doctrine/coding-standard:~0.1@dev
7091
```
7192

7293
Then you can use it like:
@@ -82,7 +103,7 @@ If you are contributing to the Doctrine Coding Standard and want to test your co
82103
make sure all dependencies are correctly installed:
83104

84105
```bash
85-
$ php composer.phar install --prefer-source --dev
106+
$ php composer install --prefer-source
86107
```
87108

88109
The option `--prefer-source` is particularly necessary to ensure the test suite from PHP_CodeSniffer is

composer.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@
1010
{"name": "Steve Müller", "email": "[email protected]"}
1111
],
1212
"require": {
13-
"php": ">=5.3"
13+
"php": ">=5.3",
14+
"squizlabs/php_codesniffer": "~1.0"
1415
},
1516
"require-dev": {
16-
"squizlabs/php_codesniffer": "1.*",
1717
"phpunit/phpunit": "~4.7"
1818
},
19-
"target-dir": "Doctrine"
19+
"target-dir": "Doctrine",
20+
"extra": {
21+
"branch-alias": {
22+
"dev-master": "0.1-dev"
23+
}
24+
}
2025
}

0 commit comments

Comments
 (0)