Download the PHP package lvandi/php-crap-checker without Composer

On this page you can find all versions of the php package lvandi/php-crap-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-crap-checker

php-crap-checker

CI Latest Stable Version PHP Version codecov

A CI quality gate for method-level change risk in PHP projects.

Why this tool exists

Complex code with low test coverage is risky to change. The CRAP score captures this pattern in a single number. crap-check turns that signal into a CI gate: if any method exceeds the threshold, the build fails.

This matters in any workflow where code can be generated, refactored, or expanded quickly — including AI-assisted development — because static analysis and basic tests can pass while change risk quietly accumulates at method level.

What is the CRAP score?

CRAP (Change Risk Anti-Patterns) is a metric that combines cyclomatic complexity and test coverage. A method scores higher when it is both complex and poorly tested. The formula is:

A low CRAP score means the method is either simple, well-tested, or both. A high score is a signal worth investigating — not necessarily a hard blocker, but a starting point for review.

What this package does

What this package does NOT do

Installation

Usage

Basic usage

The report argument defaults to build/crap4j.xml and --threshold defaults to 30.

Options

Option Default Description
report build/crap4j.xml Path to the Crap4J XML report
--threshold 30 Maximum allowed CRAP score (exclusive)
--max-violations (none) Maximum number of violations before CI fails
--max-age (none) Maximum report age; accepts minutes (60), or duration strings (30m, 2h)
--format text Output format (text, json)

Usage in GitHub Actions

Full example with PHP matrix:

Usage with Codecov

php-crap-checker and Codecov serve different purposes and work well together:

Codecov tracks overall and patch coverage. crap-check enforces a per-method CRAP threshold. They complement each other.

Exit codes

Code Meaning
0 OK — no violations
1 CRAP threshold exceeded
2 Invalid input (e.g. non-numeric threshold)
3 Report file not found or not readable
4 Invalid XML in report
5 Report valid but contains no methods

Output examples

No violations

Violations found

Report not found

A note on PCOV and Xdebug

PCOV and Xdebug are not required by this package. They are required by PHPUnit to generate the Crap4J report. Once the report exists, crap-check reads the XML and needs no coverage driver.

In CI, install PCOV (faster) or Xdebug only in the step that generates coverage:

If you already have a report from a previous step or artifact, you can run crap-check without any coverage extension.

Interpreting a high CRAP score

A high CRAP score on a method is a signal, not a verdict. Before raising the threshold or suppressing the check, consider:

Mechanically writing tests just to lower the number defeats the purpose. Use the score to guide meaningful improvement.

Adopting on a legacy project

If your codebase already has many violations, a zero-tolerance threshold from day one is counterproductive. See docs/ADOPTING.md for gradual adoption strategies: start permissive and tighten over time, cap violations with --max-violations, and how to talk to your team about the metric.

Planned

Future releases may add:

Requirements

Development

PHP runs inside Docker. Build the image once (uses your host UID/GID to avoid file permission issues):

Common commands:

Contributing

Contributions are welcome. See CONTRIBUTING.md for guidelines on opening issues and submitting pull requests.

To report a security vulnerability, follow the process described in SECURITY.md.

This project is released under the MIT License.


All versions of php-crap-checker with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-simplexml Version *
symfony/console Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lvandi/php-crap-checker contains the following files

Loading the files please wait ...