Skip to content

Commit

Permalink
Merge pull request #4 from phansys/composer_improvements
Browse files Browse the repository at this point in the history
[Install] Some updates
  • Loading branch information
Ocramius committed Jul 16, 2015
2 parents 20889dc + 722b9bc commit fe7696b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 526 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor/
*.phpunit.xml
composer.lock
49 changes: 35 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can install the Doctrine Coding Standard as a plugin into your global system

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

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

### 2. Custom installation
### 2. Global installation

You also can install the Doctrine Coding Standard globally:

```bash
$ php composer global require doctrine/coding-standard:~0.1@dev
```

Then you can use it like:

```bash
$ phpcs --standard=~/.composer/vendor/doctrine/coding-standard/Doctrine /path/to/some/file/to/sniff.php
```

Or even set it as default standard:

```bash
$ phpcs --config-set default_standard ~/.composer/vendor/doctrine/coding-standard/Doctrine
```

And just sniff a particular file with:

```bash
$ phpcs /path/to/some/file/to/sniff.php
```

### 3. Custom installation

You can install the Doctrine Coding Standard anywhere you want:

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

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

```bash
$ phpcs --standard=/path/to/whatever/directory/you/want/Doctrine /path/to/some/file/to/sniff.php
$ ./vendor/bin/phpcs --standard=. /path/to/some/file/to/sniff.php
```

### 3. As a composer dependency of your project
### 4. As a composer dependency of your project

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

```js
{
"require": {
"doctrine/coding-standard": "dev-master"
}
}
```bash
$ php composer require doctrine/coding-standard:~0.1@dev
```

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

```bash
$ php composer.phar install --prefer-source --dev
$ php composer install --prefer-source
```

The option `--prefer-source` is particularly necessary to ensure the test suite from PHP_CodeSniffer is
Expand Down
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
{"name": "Steve Müller", "email": "st.mueller@dzh-online.de"}
],
"require": {
"php": ">=5.3"
"php": ">=5.3",
"squizlabs/php_codesniffer": "~1.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "1.*",
"phpunit/phpunit": "~4.7"
},
"target-dir": "Doctrine"
"target-dir": "Doctrine",
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
}
}
}

0 comments on commit fe7696b

Please sign in to comment.