ofbeaton / granite-php
Opinionated PHP Coding Style enforcement for PHP
Installs: 511
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 21
pkg:composer/ofbeaton/granite-php
Requires (Dev)
Suggests
- jakub-onderka/php-console-highlighter: Highlight syntax for php-parallel-lint
- jakub-onderka/php-parallel-lint: speed up `php -l` check
- squizlabs/php_codesniffer: check and fix granite code style
README
Opinionated coding style enforcement for PHP.
Contains
We make use of the following programs:
Installing via Composer
The recommended way to install granite-php is through Composer. Ensure you have it installed first.
Next, run the Composer command to install the latest stable version:
composer require ofbeaton/granite-php composer require squizlabs/php_codesniffer composer require jakub-onderka/php-parallel-lint jakub-onderka/php-console-highlighter
Edit your composer.json and add or modify scripts section:
{
...
"scripts": {
"check": [
"parallel-lint . --exclude vendor",
"phpcs -p --standard=vendor/ofbeaton/granite-php/phpcs/granite --ignore=vendor src"
],
"fix": [
"phpcbf -p --standard=vendor/ofbeaton/granite-php/phpcs/granite --ignore=vendor src"
],
"check-tests": [
"parallel-lint . --exclude vendor",
"phpcs -p --standard=vendor/ofbeaton/granite-php/phpcs/granite-tests --ignore=vendor tests"
],
"fix-tests": [
"phpcbf -p --standard=vendor/ofbeaton/granite-php/phpcs/granite-tests --ignore=vendor tests"
],
"test": [
"@check",
"@check-tests"
]
},
...
}
And update your project:
composer update ofbeaton/granite-php
After updating, you can now run granite-php:
composer test
Running granite-php on test suites
You usually want to relax some requirements for test suites, in that case run:
composer check-tests
Documentation
Please head over to the PHP page on the Granite wiki.
License
This software is distributed under the MIT License. Please see License file for more information.