jdolba / silverstripe-coding-standards
Coding standards and more for your SilverStripe project
Installs: 4 648
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ^7.1
- consistence/coding-standard: ^3.7
- jakub-onderka/php-parallel-lint: ^1.0
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2025-02-24 13:01:38 UTC
README
Set of definition and coding standards rules for your SilverStripe project
Install
Via Composer
composer require --dev jdolba/silverstripe-coding-standards ^0.1
Usage
Example of usage with composer scripts:
- Add scripts to your composer.json file
"scripts": { "silverstripe-standards": [ "@php-lint", "@phpcs" ], "php-lint": "parallel-lint app/src app/tests", "phpcs": "phpcs app/src app/tests --standard=vendor/jdolba/silverstripe-coding-standards/definitions/php/phpcs-ss4.xml --extensions=php --encoding=utf-8", "phpcbf": "phpcbf app/src app/tests --standard=vendor/jdolba/silverstripe-coding-standards/definitions/php/phpcs-ss4.xml --extensions=php --encoding=utf-8", "phpcs-fix": "@phpcbf" },
- then run:
composer silverstripe-standards
- to fix your Standards violations you can run
composer phpcs-fix
# or
composer phpcbf
Custom rules
you can also customize rules by adding phpcs.xml
file directly to you project root:
cp vendor/jdolba/silverstripe-coding-standards/skeletons/phpcs.xml phpcs.xml
don't forgot to change paths in composer scripts (--standard=phpcs.xml
)
.editorconfig
you can use prepared .editorconfig
file (see https://editorconfig.org/)
cp vendor/jdolba/silverstripe-coding-standards/skeletons/.editorconfig .editorconfig
Credits
License
The MIT License (MIT). Please see License File for more information.