coding-standard/README.md

1.9 KiB

Crawl Coding Standard

Latest Version on Packagist Total Downloads

This package provides rule sets for the Crawl Coding Standard. It requires squizlabs/php_codesniffer and some extensions (see composer.json).

Installation

You can install the package via composer (you should only need it for development):

composer require crawl/coding-standard --dev

Usage

Depending on your project, copy phpcs-laravel.xml or phpcs-package.xml from config/ to your project.

Note: don't forget to update Package\Namespace when using phpcs-package.xml.

You can then run PHP Code Sniffer/Beautifier:

$ vendor/bin/phpcs --standard=./path/to/copied/phpcs.xml
$ vendor/bin/phpcbf --standard=./path/to/copied/phpcs.xml

For easier usage, add the following to scripts in your project's composer.json:

    ...
    "scripts": {
        ...
        "style": "vendor/bin/phpcs --standard=./path/to/copied/phpcs.xml",
        "fix-style": "vendor/bin/phpcbf --standard=./path/to/copied/phpcs.xml",
    }.
    ...

You can then use composer style to run the sniffer, and composer fix-style to run the beautifier.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@gkcld.net instead of using the issue tracker.

Authors

License

The MIT License (MIT). Please see LICENSE for more information.