PHPackages                             tripomatic/php-code-quality - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. tripomatic/php-code-quality

ActiveLibrary[Testing &amp; Quality](/categories/testing)

tripomatic/php-code-quality
===========================

A set of PHP code quality tools

3426PHP

Since Jun 16Pushed 10y ago10 watchersCompare

[ Source](https://github.com/tripomatic/php-code-quality)[ Packagist](https://packagist.org/packages/tripomatic/php-code-quality)[ RSS](/packages/tripomatic-php-code-quality/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Tripomatic\\PhpCodeQuality
==========================

[](#tripomaticphpcodequality)

A set of PHP code quality tools for VCS.

Tripomatic\\PhpCodeQuality allows for automatic PHP code checking while commiting changes in VCS. At the moment [Git](https://git-scm.com) and [Mercurial](https://mercurial.selenic.com) are supported. The tool can perform the following pre-commit checks:

1. If both `composer.json` and `composer.lock` are versioned it checks whether they are in sync.
2. All changed or added PHP files are checked for syntax errors with `php -l`.
3. All changed or added PHP files are chekced for coding style with [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer). This check requires coding style definition file `.php_cs` in the repository root.

Installation
------------

[](#installation)

Install Tripomatic\\PhpCodeQuality using [Composer](https://getcomposer.org):

```
$ composer require --dev tripomatic/php-code-quality
```

To setup automatic code checking before every commit add the following line to your pre-commit hook:

```
php vendor/bin/php-code-quality check-staged-files

```

The tool automatically detects the repository type (Git, Mercurial) and checks the changes to be commited.

> In Git these changes doesn't have to reflect the working tree so the actual changes are fetched to a temporary directory and the files are controlled there. The directory is automatically removed.

Automatic setup with Composer
-----------------------------

[](#automatic-setup-with-composer)

The pre-commit hooks can be also set-up automatically using [Composer's scripts](https://getcomposer.org/doc/articles/scripts.md). For instance you can add the following lines to your `composer.json`:

```
"scripts": {
	"pre-install-cmd": "sh git/install-hooks.sh",
	"pre-update-cmd": "sh git/install-hooks.sh"
}
```

And create a `git/install-hooks.sh` file containing:

```
#!/bin/sh
ROOT="$(cd "$(dirname "$0")"/..; pwd -P)"

echo "Installing GIT hooks"
rm -rf ${ROOT}/.git/hooks
ln -s ${ROOT}/git/hooks ${ROOT}/.git/hooks
chmod +x ${ROOT}/.git/hooks/*
```

And finally, create a `git/hooks` directory and a `pre-commit` file in it containing:

```
#!/bin/sh
ROOT="$(cd "$(dirname "$0")"/../..; pwd -P)"

php ${ROOT}/vendor/bin/php-code-quality check-staged-files
```

The `git` directory can be added to the repository and that way the pre-commit code-checking hook will be automatically installed on any `composer install` and `composer update`.

Other
-----

[](#other)

In case you use tabs for indenting this package contains also an [`IndentWithTabsFixer`](src-cs/Fixer/Contrib/IndentWithTabsFixer.php) for [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer). Installing in the `.php_cs` is easy:

```
return Symfony\CS\Config\Config::create()
	->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
	->addCustomFixer(new Symfony\CS\Fixer\Contrib\IndentWithTabsFixer())
	->fixers([
	    '-indentation', # turn off the PSR-2 rule
	    'indent_with_tabs',
	]);
```

A complete example can be the [`.php_cs`](.php_cs) for this repository.

License
-------

[](#license)

Tripomatic\\PhpCodeQuality is licensed under [MIT](LICENSE).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/89b00846b968f3a65171e5c8b752e6eaddae71c0e7ee070ed90a6636d66038e2?d=identicon)[JanJakes](/maintainers/JanJakes)

---

Top Contributors

[![JanJakes](https://avatars.githubusercontent.com/u/141436?v=4)](https://github.com/JanJakes "JanJakes (3 commits)")

### Embed Badge

![Health badge](/badges/tripomatic-php-code-quality/health.svg)

```
[![Health](https://phpackages.com/badges/tripomatic-php-code-quality/health.svg)](https://phpackages.com/packages/tripomatic-php-code-quality)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
