PHPackages                             unionofrad/li3\_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. unionofrad/li3\_quality

ActiveLithium-library[Testing &amp; Quality](/categories/testing)

unionofrad/li3\_quality
=======================

This li₃ plugin adds code quality assurance to your toolbelt.

v1.0.0(9y ago)1288.2k↓22.6%10[10 issues](https://github.com/UnionOfRAD/li3_quality/issues)BSD-3-clausePHPPHP &gt;=5.3

Since Dec 15Pushed 9y ago8 watchersCompare

[ Source](https://github.com/UnionOfRAD/li3_quality)[ Packagist](https://packagist.org/packages/unionofrad/li3_quality)[ Docs](http://li3.me)[ RSS](/packages/unionofrad-li3-quality/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (9)Used By (0)

Quality
=======

[](#quality)

**This li₃ plugin adds code quality assurance to your toolbelt.**

Key Features
------------

[](#key-features)

- Detect coding-standard violations.
- Find weak- or untested classes/methods.
- No external dependencies.
- Color-Highlighting.
- Integrates into the Lithium test dashboard.
- Runs on Windows without hassle.
- Cool shortcuts to ease your workflow.

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

[](#installation)

The preferred installation method is via composer. You can add the library as a dependency via:

```
composer require unionofrad/li3_quality

```

li₃ libraries must be registered within your application bootstrap phase as they use a different (faster) autoloader.

```
Libraries::add('li3_quality')
```

If you open the test dashboard (under `/test` in your browser), you should have an additional `Syntax` button to check the files directly in your browser.

Usage: The "syntax" command
---------------------------

[](#usage-the-syntax-command)

If you just run it with `li3 syntax`, it will run all rules against your `app` library.

```
$ li3 syntax --verbose path/to/code
--------------------
Lithium Syntax Check
--------------------
Performing 16 rules on 6 classes.
[FAIL] app\models\Authors
Line    Position        Violation
----    --------        ---------
7       1               Trailing whitespace found
[OK] app\models\Groups
[OK] app\models\Posts
[FAIL] app\controllers\HelloWorldController
Line    Position        Violation
----    --------        ---------
17      -               Function "to_string" is not in camelBack style
21      -               Function "to_json" is not in camelBack style
24      1               Trailing whitespace found
[FAIL] app\controllers\PagesController
Line    Position        Violation
----    --------        ---------
32      1               Trailing whitespace found
34      1               Trailing whitespace found
28      -               Protected Method "view" does not start with "_"
33      -               Protected Method "foobar" does not start with "_"
```

Usage: The "fix" command
------------------------

[](#usage-the-fix-command)

The fix command helps in migrating code to newer versions. It'll rewrite existing source code files and update them in place. Please note that you should use a version control system when using this command, as the results may not always be 100% what you'd expect.

```
$ li3 fix --verbose path/to/code

```

Custom Rules &amp; Rule Sets
----------------------------

[](#custom-rules--rule-sets)

Rule based commands (syntax and fix) will work only with a rule set configuration file. If none is provided through the `--config=` option, these commands fall back to use the default configuration files in `config/syntax.json` and `config/fix.json`respectively.

Custom rules must be create as i.e. `/extensions/qa/rules/{syntax,fix}/YourCustomRule.php`.

GIT Pre Commit Hook
-------------------

[](#git-pre-commit-hook)

This pre commit hook is based upon the example found in `.git/hooks/pre-commit.sample`. Copy the sample script to `/path/to/project/.git/hooks/pre-commit` and make it executable. Then, replace the code in the script with the code shown below and adjust the paths to the plugin and the li3 command.

```
cd /path/to/project
cp .git/hooks/pre-commit.sample .git/hooks/pre-commit
chmod a+x .git/hooks/pre-commit

```

Now add the following code to .git/hooks/pre-commit and adjust the `APP` and `LI3` values.

```
#!/bin/sh

APP=/path/to/li3_quality_enabled/app/
LI3=/path/to/lithium/libraries/lithium/console/li3

if git-rev-parse --verify HEAD >/dev/null 2>&1
then
    AGAINST=HEAD
else
    # Initial commit: diff against an empty tree object
    AGAINST=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

EXIT_STATUS=0
PROJECT=`pwd`

for FILE in `git diff-index --cached --name-only --diff-filter=AM ${AGAINST}`
do
    cd ${APP} && ${LI3} syntax ${PROJECT}/${FILE}
    test $? != 0 && EXIT_STATUS=1
done

exit ${EXIT_STATUS}
```

Now when committing each file the syntax is checked. The commit is aborted if a check failed. If you don't want to have the hook run on commit pass the `--no-verify` option to git commit.

Usage: The "coverage" command
-----------------------------

[](#usage-the-coverage-command)

With `li3 coverage` you can get a summary of how well your classes are covered with tests. This makes use of some `xdebug` functions, so make sure to have it installed.

```
$ li3 quality coverage
---------------------
Lithium Code Coverage
---------------------
Checking coverage on 6 classes.
   no test |     n/a | app\models\Authors
   no test |     n/a | app\models\Groups
   no test |     n/a | app\models\Posts
   no test |     n/a | app\controllers\HelloWorldController
   no test |     n/a | app\controllers\PagesController
   no test |     n/a | app\controllers\PostsController
```

You can also reuse the `--library` argument as well. In addition, this command provides an optional `--threshold` argument that only displays coverage below the given amount. This defaults to 100, so all classes will be shown. If you have coloring on your shell (likely not on windows), then the classes are colored to reflect the coverage policy of the Lithium framework (0% or no test is red, 85% or higher is green and the rest is yellow).

Copyright &amp; License
-----------------------

[](#copyright--license)

Copyright 2011 Union of RAD. All rights reserved. This library is distributed under the terms of the BSD 3-Clause License. The full license text can be found in the LICENSE.txt file.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance3

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~184 days

Recently: every ~80 days

Total

8

Last Release

3609d ago

Major Versions

v0.2 → v1.0.0-rc12015-08-13

PHP version history (2 changes)v0.1PHP &gt;=5.3

1.1.x-devPHP &gt;=5.5.14

### Community

Maintainers

![](https://www.gravatar.com/avatar/16569d971433c3ff4ba70b299d077360f12fdce8d61c561dd6710fcf05688473?d=identicon)[nate](/maintainers/nate)

![](https://www.gravatar.com/avatar/a358e1a5ab7f7c81ecaae07acd830aa4a36726ab4da46a11df754a6e5b3a4cda?d=identicon)[mariuswilms](/maintainers/mariuswilms)

---

Top Contributors

[![daschl](https://avatars.githubusercontent.com/u/29086?v=4)](https://github.com/daschl "daschl (37 commits)")[![mariuswilms](https://avatars.githubusercontent.com/u/29702?v=4)](https://github.com/mariuswilms "mariuswilms (29 commits)")[![jails](https://avatars.githubusercontent.com/u/1306941?v=4)](https://github.com/jails "jails (28 commits)")[![nateabele](https://avatars.githubusercontent.com/u/18288?v=4)](https://github.com/nateabele "nateabele (25 commits)")[![gwoo](https://avatars.githubusercontent.com/u/13685?v=4)](https://github.com/gwoo "gwoo (13 commits)")[![eLod](https://avatars.githubusercontent.com/u/286779?v=4)](https://github.com/eLod "eLod (12 commits)")[![michaelhue](https://avatars.githubusercontent.com/u/31861?v=4)](https://github.com/michaelhue "michaelhue (2 commits)")[![mehlah](https://avatars.githubusercontent.com/u/224928?v=4)](https://github.com/mehlah "mehlah (1 commits)")[![Ciaro](https://avatars.githubusercontent.com/u/891736?v=4)](https://github.com/Ciaro "Ciaro (1 commits)")

---

Tags

pluginplugincoveragelithiumqualitysyntaxli3

### Embed Badge

![Health badge](/badges/unionofrad-li3-quality/health.svg)

```
[![Health](https://phpackages.com/badges/unionofrad-li3-quality/health.svg)](https://phpackages.com/packages/unionofrad-li3-quality)
```

###  Alternatives

[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

598161.9M1.9k](/packages/dealerdirect-phpcodesniffer-composer-installer)[unionofrad/li3_docs

An API and wiki-like documentation generator.

1682.6k](/packages/unionofrad-li3-docs)

PHPackages © 2026

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