Skip to content

Minstel/php-code-quality

 
 

Repository files navigation

PHP code quality

Build Status Code Coverage Scrutinizer Code Quality SensioLabsInsight

Coding standard

The Jasny PHP coding standard follows the PSR-2 coding standard with a few additions.

Installation

All PHP projects of Legal Things should include this package. It can be installed through composer.

composer require --dev jasny/php-code-quality

Toolchain

PHPUnit

PHPUnit is a programmer-oriented testing framework for PHP. The unit tests should be in the tests directory.

Copy the PHPUnit configuration into the projects root folder

cp vendor/jasny/php-code-quality/phpunit.xml.dist .

vfsStream

vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system.

PHP_CodeSniffer

phpcs tokenises PHP files and detects violations of a defined set of coding standards. It is an essential development tool that ensures your code remains clean and consistent. This package comes with a custom ruleset which embodies the Jasny PHP coding standard.

vendor/bin/phpcs . --standard=vendor/jasny/php-code-quality --ignore=/vendor/,/tests/

CodeSniffer is able to fix simple issues automatically

vendor/bin/phpcbf . --standard=vendor/jasny/php-code-quality --ignore=/vendor/,/tests/

Codecoption (applications only)

Codeception is a BDD style testing frameworks for PHP. It can be used for unit, functional and integration tests.

The [Codeception module for Jasny MVC] allows you to run tests for applications that use Jasny MVC.

Codeception isn't installed by default. It can be installed through composer.

composer require --dev codeception/codeception jasny/codeception-module

Services

Travis

Travis CI will run all tests on each pull-request and push to the master branch.

Copy the Travis CI configuration file from the php-code-quality directory.

cp vendor/jasny/php-code-quality/travis.yml.dist .travis.yml

This service is only used for open-source projects.

Scrutinizer

Scrutinizer tests code quality.

Scrutizer is also used for building and running tests for Jasny's closed source projects.

SensioLabsInsight

SensioLabsInsight gives automatic and unique advise for increasing code quality.

This service is only used for open-source projects.

About

Quality assurance toolchain

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%