arty / php-coding-standard
Static analysis tools config for PHP projects, by arty.
Installs: 42
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 6
Type:phpcodesniffer-standard
Requires
- php: ^8.3
- jangregor/phpstan-prophecy: ^1.0
- phpmd/phpmd: ^2.15
- phpspec/prophecy-phpunit: ^2.1
- phpstan/phpstan: ^1.10
- phpstan/phpstan-phpunit: ^1.3
- phpunit/phpunit: ^10.5
- slevomat/coding-standard: ^8.14
- squizlabs/php_codesniffer: ^3.8
Requires (Dev)
- roave/security-advisories: dev-latest
- dev-main
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/github_actions/actions/download-artifact-4.1.7
- dev-dependabot/github_actions/shivammathur/setup-php-2.30.4
- dev-dependabot/github_actions/actions/checkout-4.1.4
- dev-dependabot/github_actions/actions/upload-artifact-4.3.3
- dev-dependabot/github_actions/shivammathur/setup-php-2.30.3
- dev-dependabot/github_actions/actions/download-artifact-4.1.6
- dev-dependabot/github_actions/actions/checkout-4.1.3
- dev-dependabot/github_actions/actions/cache-4.0.2
- dev-dependabot/composer/phpunit/phpunit-tw-10.5or-tw-11.0
This package is auto-updated.
Last update: 2024-04-24 17:41:45 UTC
README
This is the coding style tools config I use everyday on my projects.
it includes :
- PHPCS for code sniffing.
- PHPStan for static bug finding into code.
- PHPMD for static performance analysis (complexity, unused expressions, optimizing).
Installation
Installation with composer :
composer require arty/php-coding-standard --dev
Usage
PHPCS
In your project, create a phpcs.xml
file and fill it up with :
<?xml version="1.0"?> <ruleset name="Arty Coding Standard" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd"> <rule ref="./vendor/arty/php-coding-standard/lib/phpcs/phpcs.xml" /> </ruleset>
Run it with :
$ ./vendor/bin/phpcs src
PHPStan
In your project, create a phpstan.neon
file and fill it up with :
includes: - vendor/arty/php-coding-standard/lib/phpstan/phpstan.neon
Run it with :
$ ./vendor/bin/phpstan analyse --level=max src
PHPMD
In your project, create a phpmd.xml
file and fill it up with :
<?xml version="1.0"?> <ruleset name="Arty ruleset" xmlns="http://pmd.sf.net/ruleset/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> <description> Arty ruleset </description> <rule ref="./vendor/arty/php-coding-standard/lib/phpmd/phpmd.xml"/> </ruleset>
Run it with :
$ ./vendor/bin/phpmd src text phpmd.xml