Skip to content

Commit

Permalink
Merge pull request #141 from Dealerdirect/feature/readme-update-for-c…
Browse files Browse the repository at this point in the history
…omposer-2.2

README: update with information about Composer >= 2.2
  • Loading branch information
Potherca committed Jan 25, 2022
2 parents 858566c + d3afb2a commit 09874cb
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions README.md
Expand Up @@ -25,6 +25,24 @@ Installation can be done with [Composer][composer], by requiring this package as
composer require --dev dealerdirect/phpcodesniffer-composer-installer
```

When using Composer 2.2 or higher, Composer will [ask for your permission](https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution) to allow this plugin to execute code. For this plugin to be functional, permission needs to be granted.

When permission has been granted, the following snippet will automatically be added to your `composer.json` file by Composer:
```json
{
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
```

When using Composer < 2.2, you can add the permission flag ahead of the upgrade to Composer 2.2, by running:
```bash
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
```

That's it.

### Compatibility
Expand Down Expand Up @@ -62,6 +80,11 @@ multiple `phpcodesniffer-standard` packages.
"object-calisthenics/phpcs-calisthenics-rules": "*",
"phpcompatibility/php-compatibility": "*",
"wp-coding-standards/wpcs": "*"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
```
Expand Down Expand Up @@ -93,7 +116,6 @@ section of the `composer.json`:
]
}
}

```

The command can then be called using `composer run-script install-codestandards` or
Expand All @@ -110,7 +132,6 @@ referenced from other script configurations, as follows:
]
}
}

```

For more details about Composer scripts, please refer to [the section on scripts
Expand Down Expand Up @@ -148,8 +169,8 @@ Create a composer package of your coding standard by adding a `composer.json` fi
"name" : "acme/phpcodesniffer-our-standards",
"description" : "Package contains all coding standards of the Acme company",
"require" : {
"php" : ">=5.4.0,<8.0.0-dev",
"squizlabs/php_codesniffer" : "^3.0"
"php" : ">=5.4.0",
"squizlabs/php_codesniffer" : "^3.6"
},
"type" : "phpcodesniffer-standard"
}
Expand Down

0 comments on commit 09874cb

Please sign in to comment.