Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README: update with information about Composer >= 2.2 #141

Merged
merged 3 commits into from
Jan 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
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