PHPackages                             voku/itp-context - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. voku/itp-context

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

voku/itp-context
================

Architecture context attributes, inline enum rule definitions, validation and summarization helpers for PHP projects.

0.3.0(1mo ago)75[1 issues](https://github.com/voku/itp-context/issues)[1 PRs](https://github.com/voku/itp-context/pulls)MITPHPPHP &gt;=8.3.0CI passing

Since Mar 18Pushed 1mo agoCompare

[ Source](https://github.com/voku/itp-context)[ Packagist](https://packagist.org/packages/voku/itp-context)[ Docs](https://github.com/voku/itp-context)[ RSS](/packages/voku-itp-context/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (4)Versions (14)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/59f28d10c04477cf69a7873686f64478e76ca4bf347b7bc7102c2fcb0cf8bdd3/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f6974702d636f6e746578742f762f737461626c65)](https://packagist.org/packages/voku/itp-context)[![Total Downloads](https://camo.githubusercontent.com/fd6b2521a4a185e7f6406f2e500526622997447e3c5a820f769ca6433ed1da5c/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f6974702d636f6e746578742f646f776e6c6f616473)](https://packagist.org/packages/voku/itp-context)[![License](https://camo.githubusercontent.com/3fb7def1d5390a7e09b93c6f0897f42e7eb28c82cf1b44aff629d873a0706c8f/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f6974702d636f6e746578742f6c6963656e7365)](https://packagist.org/packages/voku/itp-context)

🎯 itp-context
=============

[](#-itp-context)

A small PHP library for attaching architecture rules to code via PHP attributes and resolving those rules directly from typed enums.

It gives you:

- typed rule identifiers via enums
- repeatable `#[Rule(...)]` attributes for classes, methods and functions
- inline enum rule definitions with ownership, rationale, references and proof metadata
- validation helpers for broken or incomplete rule definitions
- summary output for annotated PHP symbols, including multiple symbols per file
- compact markdown context exports with searchable metadata for coding agents and repository assistants
- a small query helper for searching exported context by rule, owner, proof, refs or free text
- a small generator for bootstrapping new rule enums

Index
-----

[](#index)

- [Install](#install-via-composer-require)
- [Why?](#why)
- [Usage](#usage)
- [Local Development](#local-development)
- [Project Structure](#project-structure)
- [CLI Tools](#cli-tools)
- [Tests](#tests)
- [License](#license)

Install via "composer require"
------------------------------

[](#install-via-composer-require)

```
composer require voku/itp-context
```

Why?
----

[](#why)

When architecture guidance only lives in ADRs and wikis, it drifts away from the code that is supposed to follow it.

`itp-context` keeps the rule identifier, definition, and supporting context references together in one typed enum instead of splitting them across sibling catalog files. That gives you a compact way to:

- attach architecture intent to classes, methods and functions
- validate whether enum cases still expose usable definitions
- summarize relevant architecture context for one PHP file

The goal is to add context **without burning tokens**:

- prefer a few broad, high-signal rules over many narrow ones
- annotate central symbols, not every class in the tree
- export compact markdown that is easy for humans and LLMs to scan

Usage
-----

[](#usage)

### 1. Create a rule enum in your project

[](#1-create-a-rule-enum-in-your-project)

```
