ubc / ctlt-coding-standard
CTLT PHP CodeSniffer Coding Standard
1.0
2014-07-29 00:28 UTC
Suggests
- m6web/coke: PHP CodeSniffer configurator
- m6web/symfony2-coding-standard: Symfony2 PHP CodeSniffer Coding Standard
- squizlabs/php_codesniffer: PHP CodeSniffer
This package is not auto-updated.
Last update: 2025-02-25 04:45:00 UTC
README
A code standard based on Symfony 2 coding standards.
Installation (Composer)
-
Add the dependency to composer.json:
{ "require-dev": { "ubc/ctlt-coding-standard": "~1.0", } }
-
Install dependencies
composer update
-
Use it
phpcs --standard=vendor/ubc/ctlt-coding-standard/ruleset.xml --runtime-set installed_paths vendor/m6web/symfony2-coding-standard src/*
Or add the following Phing task:
<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<phpcodesniffer standard="${vendordir}/ubc/ctlt-coding-standard/ruleset.xml">
<config name="installed_paths" value="${vendordir}/m6web/symfony2-coding-standard"/>
<fileset dir="${sourcedir}">
<include name="**/*.php" />
</fileset>
</phpcodesniffer>
</target>
Installation (Pear)
-
Install phpcs:
pear install PHP_CodeSniffer
-
Find your PEAR directory:
pear config-show | grep php_dir
-
Copy, symlink or check out this repo and Symfony2 coding standard to the phpcs
Standards
directory:cd /path/to/pear/PHP/CodeSniffer/Standards git clone git://github.com/opensky/Symfony2-coding-standard.git Symfony2 git clone git://github.com/ubc/CTLT-PHP-coding-standard.git CTLT
-
Set CTLT as your default coding standard:
phpcs --config-set default_standard CTLT
-
...
-
Profit!
cd /path/to/my/project phpcs phpcs path/to/my/file.php