PHPackages                             adiachenko/knotbane - 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. adiachenko/knotbane

ActiveLibrary

adiachenko/knotbane
===================

Find cyclomatic complexity hotspots in targeted PHP code

v1.0.0(today)01↑2900%MITPHPPHP ^8.4CI passing

Since Jul 31Pushed todayCompare

[ Source](https://github.com/adiachenko/knotbane)[ Packagist](https://packagist.org/packages/adiachenko/knotbane)[ RSS](/packages/adiachenko-knotbane/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Knotbane
========

[](#knotbane)

[![Tests](https://github.com/adiachenko/knotbane/actions/workflows/tests.yml/badge.svg)](https://github.com/adiachenko/knotbane/actions/workflows/tests.yml)

Knotbane finds cyclomatic complexity hotspots in targeted PHP code. It wraps [`sebastian/complexity`](https://github.com/sebastianbergmann/complexity) in a small Composer-installed CLI.

Complexity is a review signal, not a quality verdict. Knotbane identifies where to look; it does not fail a run merely because a code unit has a high score.

Requirements
------------

[](#requirements)

PHP &gt;= 8.4 (the package follows a rolling support policy covering the latest two PHP minor versions).

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

[](#installation)

Install Knotbane as a development dependency:

```
composer require --dev adiachenko/knotbane
```

For one-off use without adding Knotbane to your project, run it through [CPX](https://github.com/laravel/cpx):

```
cpx adiachenko/knotbane src
```

Usage
-----

[](#usage)

Pass one or more PHP files or directories:

```
vendor/bin/knotbane src app/Http/Controllers/CheckoutController.php
```

Knotbane combines all targets into one report and orders code units from highest to lowest complexity. Directory targets are scanned recursively for PHP files; dependency directories named `vendor` and symlinked directories are skipped.

By default, the report includes code units with cyclomatic complexity 5 or greater. Set a different minimum when you need a narrower or broader view:

```
vendor/bin/knotbane --min-cc=10 src
vendor/bin/knotbane --min-cc=1 src/Checkout.php
```

Use JSON when another tool or coding agent will consume the findings:

```
vendor/bin/knotbane --json src packages/Billing/src
```

Exit status
-----------

[](#exit-status)

- `0`: analysis completed, including when no code units meet the reporting cutoff.
- `1`: at least one target or source could not be analyzed. Findings from valid sources are still reported.
- `2`: the command invocation is invalid.

Code improvement workflow
-------------------------

[](#code-improvement-workflow)

Run Knotbane on the code relevant to the current task, inspect the highest-ranked code units, and decide whether their branching is genuinely difficult to understand. After refactoring, rerun the same command and compare the ranking.

Reducing the score is not the objective by itself. Arbitrary method extraction or added indirection can lower cyclomatic complexity while making the code worse.

Agent skill
-----------

[](#agent-skill)

Knotbane includes an agent skill that targets cyclomatic complexity of 4 or lower and treats 6 as the usual maximum.

Just ask Codex or Claude Code to install [this skill](https://github.com/adiachenko/knotbane/blob/main/skills/knotbane/SKILL.md) from the repository, or run:

```
npx skills add adiachenko/knotbane --global
```

Then invoke `/knotbane` on the PHP code you want **measured and simplified**.

Contributing
------------

[](#contributing)

Install dependencies, run the command-level test suite, and format the code:

```
composer install
composer test
composer format
```

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d2e8da5aef0dbee0a910f2759dc0ffd36f6925aa32c6b0c95bdffcaf481bf0f?d=identicon)[adiachenko](/maintainers/adiachenko)

---

Top Contributors

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

---

Tags

aicyclomatic-complexity

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/adiachenko-knotbane/health.svg)

```
[![Health](https://phpackages.com/badges/adiachenko-knotbane/health.svg)](https://phpackages.com/packages/adiachenko-knotbane)
```

###  Alternatives

[phpunit/php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

8.9k951.4M1.7k](/packages/phpunit-php-code-coverage)[trebol/entrust

This package provides a flexible way to add role-based permissions to Laravel and is a fork from Zizaco/entrust

1672.9k](/packages/trebol-entrust)

PHPackages © 2026

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