ofbeaton/granite

This package is abandoned and no longer maintained. The author suggests using the ofbeaton/granite-php package instead.

Opinionated PHP Coding Style enforcement for PHP

3.1 2019-02-24 06:47 UTC

This package is auto-updated.

Last update: 2019-02-25 01:15:03 UTC


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"      
    ],
    "fix": [
      "phpcbf -p --Standard=vendor/ofbeaton/granite-php/phpcs/granite"
    ],
    "check-tests": [
      "parallel-lint . --exclude vendor",
      "phpcs -p --Standard=vendor/ofbeaton/granite-php/phpcs/granite-syntax"      
    ],
    "fix-tests": [
      "phpcbf -p --Standard=vendor/ofbeaton/granite-php/phpcs/granite-syntax"
    ],
    "test": [
      "@check",
      "@check-tests"
    ]
  },
  
  ...
}

And update your project:

composer update ofbeaton/granite-php

After updating, you can now run granite-php:

composer test

Running on granite-php on test suites

You usually want to relax some requirements for test suites, in that case run:

composer check-tests

License

This software is distributed under the MIT License. Please see License file for more information.