PHPackages                             kariricode/devkit - 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. kariricode/devkit

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

kariricode/devkit
=================

Zero-config PHP quality toolchain for KaririCode Framework. Bundles PHPUnit, PHPStan, PHP-CS-Fixer, Rector, and Psalm under a single `kcode` CLI — isolated in .kcode/ so it never pollutes production dependencies.

v1.1.4(2mo ago)02MITPHPPHP &gt;=8.4CI passing

Since Mar 2Pushed 2mo agoCompare

[ Source](https://github.com/KaririCode-Framework/kariricode-devkit)[ Packagist](https://packagist.org/packages/kariricode/devkit)[ Docs](https://kariricode.org)[ RSS](/packages/kariricode-devkit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (10)Versions (7)Used By (0)

KaririCode Devkit
=================

[](#kariricode-devkit)

[![PHP 8.4+](https://camo.githubusercontent.com/270717987f5341772d79b57567226e54ed27b2d4199bbdc98a96e2edf24902fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342532422d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/)[![Composer](https://camo.githubusercontent.com/97a043c7b7c47d58a6ec9f61ebb754057d147bdbd50fd28c6284949e046757de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6d706f7365722d322e782d3838353633303f6c6f676f3d636f6d706f736572266c6f676f436f6c6f723d7768697465)](https://getcomposer.org/)[![License: MIT](https://camo.githubusercontent.com/1e64768fef09f35b66921728160f533208fd2e3e792a2755187d16c25d535511/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d3232633535652e737667)](LICENSE)[![PHPStan Level 9](https://camo.githubusercontent.com/a812723b363d3726b682e5d739e91f2ade163846054ce3797b9085b84cc61806/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d344634364535)](https://phpstan.org/)[![Tests](https://camo.githubusercontent.com/da0e8aa448cc5e22dc1b8d26b432feaa9abb57bfe66b63e1de0ba533eac3e719/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d343125323070617373696e672d323263353565)](https://kariricode.org)[![KaririCode Framework](https://camo.githubusercontent.com/bd3e3709bf161ac982b76f7afd06c39afe478d15f2b5e1d47df8606b5c9c03f0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4b6172697269436f64652d4672616d65776f726b2d6f72616e6765)](https://kariricode.org)

**Unified quality toolchain for the KaririCode Framework ecosystem.**

One dependency. One CLI. Zero config drift across 35+ components.

[Installation](#installation) · [Quick Start](#quick-start) · [CLI Reference](#cli-reference) · [Configuration](#configuration) · [CI Integration](#ci-integration)

---

The Problem
-----------

[](#the-problem)

Every KaririCode component independently maintains five dev tools — leading to hundreds of near-identical, manually-drifting configurations:

```
composer.json          →  5 require-dev entries per component
phpunit.xml.dist       →  ~60 lines per component
phpstan.neon           →  ~25 lines per component
.php-cs-fixer.dist.php →  ~50 lines per component
rector.php             →  ~30 lines per component
psalm.xml              →  ~20 lines per component

```

Across **35+ components**, that's **175+ redundant dependency entries** and **175+ near-identical config files**. Updating a single CS-Fixer rule means 35 pull requests.

The Solution
------------

[](#the-solution)

```
composer require --dev kariricode/devkit
vendor/bin/kcode init
```

Devkit generates `.kcode/` — a gitignored directory of configs derived directly from your `composer.json`. Your five dev dependencies become one, with one canonical source of truth:

```
your-component/
├── devkit.php               ← Optional overrides (committed to git)
├── .kcode/                  ← Generated (gitignored — run `kcode init` to recreate)
│   ├── phpunit.xml.dist
│   ├── phpstan.neon
│   ├── php-cs-fixer.php
│   ├── rector.php
│   ├── psalm.xml
│   └── build/              ← Coverage reports, caches, JUnit XML
├── composer.json
├── src/
└── tests/

```

```
  "require-dev": {
-     "phpunit/phpunit": "^12.0",
-     "phpstan/phpstan": "^2.0",
-     "friendsofphp/php-cs-fixer": "^3.64",
-     "rector/rector": "^2.0",
-     "vimeo/psalm": "^6.0"
+     "kariricode/devkit": "^1.0"
  }
```

---

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

[](#requirements)

RequirementVersionPHP8.4 or higherComposer2.x---

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

[](#installation)

### As a Composer dependency *(recommended)*

[](#as-a-composer-dependency-recommended)

```
composer require --dev kariricode/devkit
```

### As a standalone PHAR

[](#as-a-standalone-phar)

```
wget https://github.com/kariricode/devkit/releases/latest/download/kcode.phar
chmod +x kcode.phar
sudo mv kcode.phar /usr/local/bin/kcode
```

---

Quick Start
-----------

[](#quick-start)

```
# Step 1 — Generate .kcode/ configs from your composer.json
vendor/bin/kcode init

# Step 2 — Remove old deps/configs (interactive prompt)
vendor/bin/kcode migrate

# Step 3 — Run the full quality pipeline
vendor/bin/kcode quality
```

---

CLI Reference
-------------

[](#cli-reference)

### `kcode init`

[](#kcode-init)

Generates or regenerates all configs inside `.kcode/` from your `composer.json`. Safe to run at any time — existing files are cleanly overwritten.

```
kcode init           # Generate configs
kcode init --config  # Also scaffold devkit.php with all available keys
```

```
✓ Project: kariricode/parser
✓ Namespace: KaririCode\Parser
✓ PHP: 8.4
✓ Generated 5 config file(s) in .kcode/
✓ .kcode/ added to .gitignore
⚠ Found 8 redundant item(s) that kcode replaces.
  Run kcode migrate to review and clean up.

```

---

### `kcode migrate`

[](#kcode-migrate)

Scans for redundant dev dependencies, root-level config files, and cache paths that Devkit now manages. Presents a full report before making any change.

```
kcode migrate                   # Interactive (default)
kcode migrate --dry-run         # Preview only — no changes applied
kcode migrate --no-interaction  # Auto-remove (for CI)
```

**Detected items:**

CategoryItems`require-dev` packages`phpunit/phpunit`, `phpstan/phpstan`, `phpstan` extensions, `php-cs-fixer`, `rector/rector`, `vimeo/psalm`Root config files`phpunit.xml(.dist)`, `phpstan.neon(.dist)`, `.php-cs-fixer(.dist).php`, `rector.php`, `psalm.xml(.dist)`Root cache paths`.phpunit.cache`, `.phpunit.result.cache`, `.phpstan`, `.php-cs-fixer.cache`, `.psalm`---

### `kcode test`

[](#kcode-test)

Runs PHPUnit with the `.kcode/phpunit.xml.dist` configuration.

```
kcode test                           # Run all test suites
kcode test --suite=Unit              # Run a single suite
kcode test --coverage                # Generate HTML coverage report
kcode test --filter=testMyMethod     # Pass any PHPUnit argument through
```

---

### `kcode analyse`

[](#kcode-analyse)

Runs PHPStan and Psalm in sequence.

```
kcode analyse
```

---

### `kcode cs:fix`

[](#kcode-csfix)

Applies PHP-CS-Fixer with the KaririCode code standard.

```
kcode cs:fix          # Fix all violations
kcode cs:fix --check  # Dry-run — only report (no modifications)
```

---

### `kcode rector`

[](#kcode-rector)

Runs Rector. Defaults to read-only preview mode.

```
kcode rector        # Preview changes (no files modified)
kcode rector --fix  # Apply changes
```

---

### `kcode quality`

[](#kcode-quality)

Full sequential pipeline in optimal order:

```
cs:check → phpstan → psalm → phpunit

```

```
kcode quality
```

```
✓ cs-fixer   passed (1.23s)
✓ phpstan     passed (4.56s)
✓ psalm       passed (3.21s)
✓ phpunit     passed (2.10s)

✓ All 4 tool(s) passed (11.10s total)

```

---

### `kcode format`

[](#kcode-format)

Applies all auto-formatting in sequence: CS-Fixer fix + Rector apply.

```
kcode format
```

---

### `kcode security`

[](#kcode-security)

Runs `composer audit` to check for known security vulnerabilities.

```
kcode security
```

---

### `kcode clean`

[](#kcode-clean)

Removes `.kcode/build/` — caches, coverage reports, JUnit XML.

```
kcode clean
```

---

Configuration
-------------

[](#configuration)

### Auto-detection

[](#auto-detection)

Devkit reads your `composer.json` to derive all defaults automatically:

Detected FieldSourceProject name`name`Root namespace`autoload.psr-4` (first key)PHP version`require.php`Source directories`autoload.psr-4` valuesTest directories`autoload-dev.psr-4` valuesTest suitesStandard subdirs: `Unit/`, `Integration/`, `Conformance/`, `Functional/`### Project overrides via `devkit.php`

[](#project-overrides-via-devkitphp)

Create `devkit.php` in your project root to override any default. Scaffold a fully-annotated file with:

```
kcode init --config
```

Example:

```
