PHPackages                             sinefineinfinitum/mnemosyne - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sinefineinfinitum/mnemosyne

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sinefineinfinitum/mnemosyne
===========================

Ponymator - generate docs for php project

0.1.1(1mo ago)11[2 PRs](https://github.com/sinefineinfinitum/mnemosyne/pulls)MITPHPPHP ^8.0CI passing

Since Jun 1Pushed 1mo agoCompare

[ Source](https://github.com/sinefineinfinitum/mnemosyne)[ Packagist](https://packagist.org/packages/sinefineinfinitum/mnemosyne)[ RSS](/packages/sinefineinfinitum-mnemosyne/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (10)Versions (8)Used By (0)

Mnemosyne
=========

[](#mnemosyne)

[![Packagist Version](https://camo.githubusercontent.com/3b0cd3f0717310a989e5c0daa16999d838dfade8cf4f8adcc7bffffdf3e7a58c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696e6566696e65696e66696e6974756d2f6d6e656d6f73796e65)](https://packagist.org/packages/sinefineinfinitum/mnemosyne)[![PHP Version](https://camo.githubusercontent.com/3ce253cf610a6659a07e7962dadb2f06d685ca236d1d7286db4c797a1ca2b595/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302b2d707572706c65)](https://packagist.org/packages/sinefineinfinitum/mnemosyne)[![License](https://camo.githubusercontent.com/2c37a72e90e72f8babbfb82fa66c725a3c5ef70470bbdcb293c74cf6ff7ad023/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73696e6566696e65696e66696e6974756d2f6d6e656d6f73796e65)](https://packagist.org/packages/sinefineinfinitum/mnemosyne)[![CI](https://camo.githubusercontent.com/bbe005373961f7d14b0323c00717a027bad0cf009e7c9e308e2d286296880ca6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73696e6566696e65696e66696e6974756d2f6d6e656d6f73796e652f63692e796d6c3f6272616e63683d6d61696e)](https://github.com/sinefineinfinitum/mnemosyne/actions)[![PHPStan level](https://camo.githubusercontent.com/17f9c96de70e616ad864f0f6e2863ab37cabfa73b085ed6a2fcdc2c8dddd42a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d382d627269676874677265656e)](https://github.com/phpstan/phpstan)[![Mutation Score](https://camo.githubusercontent.com/def86b7eefa0f6dce8fa36ee9cca4a5b192cc5aaa993a37d429df10f9af515d3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d53492d37312532352d79656c6c6f77)](https://github.com/sinefineinfinitum/mnemosyne/actions)

A CLI-first PHP documentation generator that produces deterministic Markdown documentation for a project's API surface.

Principles
----------

[](#principles)

### AST-First Correctness

[](#ast-first-correctness)

Mnenosyne uses PHP Abstract Syntax Tree analysis (via [`nikic/php-parser`](https://github.com/nikic/PHP-Parser)) as the single source of truth. API extraction — classes, interfaces, traits, enums, constants, properties, methods, signatures, inheritance, implemented interfaces, modifiers, and dependencies — is derived from parsed PHP source code, never from regex or string matching. If source code cannot be parsed, the tool fails with actionable diagnostics.

### Deterministic Output

[](#deterministic-output)

For identical source code and configuration, repeated runs produce byte-identical Markdown files. Ordering of classes, methods, dependencies, imports, modifiers, and sections is fully deterministic, making output suitable for CI comparison.

### CLI-First Experience

[](#cli-first-experience)

ModeFlagDescriptionFull`generate --full`Regenerate all documentationDiff`generate --diff`Regenerate only changed files (default)Graph`graph import`Import PHP analysis into graph databaseShow`show entity`Analyze entity dependencies and impactExit codes:

CodeMeaning`0`Success`1`Generic error (parsing, runtime)`2`Command-line syntax error (unknown flag/command)`64`Wrong usage (invalid arguments)`65`Data error (database, entity not found)`66`Source not found`73`Output file/directory error`78`Config file missing, unreadable, or malformed### Test-First Quality

[](#test-first-quality)

Every behavior affecting documentation, CLI contracts, configuration, parsing, or exit codes is covered by PHPUnit tests. Required coverage: AST parsing, Markdown format, config validation, full generation, incremental diff, error handling.

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

[](#installation)

```
composer require sinefineinfinitum/mnemosyne
```

Usage
-----

[](#usage)

```
# Main help
vendor/bin/mnemosyne --help

# Generate documentation
vendor/bin/mnemosyne generate [--full | --diff] [--config=] [--output=md|psv1]

# Manage graph database
vendor/bin/mnemosyne graph import [--db-path=]
vendor/bin/mnemosyne graph clear

# Analyze entities
vendor/bin/mnemosyne show entity  [--depth=N]
vendor/bin/mnemosyne show impact  [--depth=N]
vendor/bin/mnemosyne show path
```

### Commands

[](#commands)

#### `generate`

[](#generate)

Produces documentation from PHP source code.

- `--full`: Force regeneration of all files.
- `--diff`: Only update files that changed since last run (default).
- `--output=md`: (Default) Standard Markdown output.
- `--output=psv1`: [mnemosyne Syntax v1](spec-ps-v1.md) (compact, machine-readable format for graph analysis).

#### `graph`

[](#graph)

Handles the SQLite graph database used for deep dependency analysis.

- `import`: Scans source code, parses AST, and populates the graph database with entities and relationships.
- `clear`: Drops all tables and recreates the schema in the graph database. Useful for a fresh start or fixing corruption.

#### `show`

[](#show)

Interactive analysis of the dependency graph. Supports FQCN or short names (if unique).

- `entity `: Shows detailed info about an entity (class, method, etc.) and its direct outgoing dependencies (structural and calls).
- `impact `: Performs reverse dependency analysis. Lists all entities that depend on the target, recursively up to `--depth`.
- `path  `: Finds the shortest path between two entities. Analyzes both forward (depends on) and reverse (is used by) relationships to show how two parts of the system are connected.
- `--depth=N`: Limits recursion depth for `impact` command (default: 3).
- `--db-path=`: Override the database path from config.

Generated Documentation Example
-------------------------------

[](#generated-documentation-example)

The generated Markdown includes YAML frontmatter with a content hash and type, followed by a summary of the entity:

```
---
type: class
hash: 3d8f1b2c9a0e
---

# `App\Service\UserService`

`final class` extends `App\Abstracts\BaseService` implements `App\Contracts\ServiceInterface`

## Constants

| Constant | Visibility | Type | Value |
| :------- | :--------- | :--- | :---- |
| `MAX_RETRIES` | public | int | `3` |

## Properties

- `public string $name`
- `protected ?int $cacheTtl = null`

## Methods

- `public static function create(``string`` $name``, ``array`` $data = []``): ``App\Models\User`
  - **Creates:**
    - [App\Models\User](../Models/User.md)
  - **Calls:**
    - `strong` `App\Service\Logger::log`
    - `strong` [App\Models\User](../Models/User.md)->save
    - `weak` `handleException`

## Used by

- [App\Contract\ServiceInterface](..\Contract\ServiceInterface.md)
- `Vendor\Package\SomeClass`
```

### Markdown Call Graph &amp; Object Creation Rules

[](#markdown-call-graph--object-creation-rules)

1. **Method-Nested Structure**: No global `Creates` or `Call Graph` sections. Object creations (`Creates`) and method calls (`Calls`) are nested directly under their respective method signature.
2. **Human-Readable Association**: Compact symbols (`*`, `?`) are replaced with explicit labels: ``strong`` or ``weak``.
3. **No Unknown Targets**: `Unknown` targets are excluded. Unresolved calls list only the called name (labeled ``weak``).
4. **Call Operator Notation**: Type of call is implied by PHP syntax instead of text tags:
    - Static: `Class::method`
    - Dynamic: `Class->method`
5. **No Duplication**: Instantiations via `new` are listed only under `Creates` and excluded from `Calls`.

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

[](#requirements)

- PHP ^8.0
- ext-json (usually built-in)

Development
-----------

[](#development)

```
composer install
vendor/bin/phpunit
vendor/bin/phpstan analyse
vendor/bin/phpcs
```

Architecture
------------

[](#architecture)

```
src/
├── Analyzer/               # AST parsing, entity & dependency extraction
│   ├── Extractor/          #  — class, interface, trait, enum extractors
│   ├── Linker/             #  — cross-reference index builder
│   ├── Visitor/            #  — AST visitors (entities, deps, creations)
├── Cli/                    # Cli Commands
├── Comparator/             # Hash-based file comparison
├── Db/                     # sqlite3 database access
├── Documentation/          # Generation, cross-linking, rendering, cleanup
│   ├── Cleaner/            #  — outdated doc removal
│   ├── Linker/             #  — cross-reference resolution
│   ├── Processor/          #  — page generation orchestration
│   └── Renderer/           #  — per-entity Markdown renderers
├── Filesystem/             # Path resolution, file scanning
├── Graph/                  # Experiemental graph database access
├── Config.php              # Configuration loading & validation
└── MnemosyneCommand.php    # Main orchestrator

```

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

[](#configuration)

Configuration file: `.mnemosyne.json`. Example:

```
{
    "source": "app",
    "target": "api-docs",
    "ignore": ["vendor", "node_modules"],
    "dbPath": "./db/path"
}
```

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance91

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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

Every ~28 days

Total

2

Last Release

34d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/183192350?v=4)[sinefineinfinitum](/maintainers/sinefineinfinitum)[@sinefineinfinitum](https://github.com/sinefineinfinitum)

---

Top Contributors

[![sinefineinfinitum](https://avatars.githubusercontent.com/u/183192350?v=4)](https://github.com/sinefineinfinitum "sinefineinfinitum (70 commits)")

---

Tags

analysisdocs

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sinefineinfinitum-mnemosyne/health.svg)

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

###  Alternatives

[deptrac/deptrac

Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.

3.0k9.8M298](/packages/deptrac-deptrac)[boundwize/structarmed

Configurable PHP architecture guards — define your layers and rules, then keep them enforced

45751.2k24](/packages/boundwize-structarmed)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[brianhenryie/strauss

Prefixes dependencies namespaces so they are unique to your plugin

192484.7k41](/packages/brianhenryie-strauss)[v.chetkov/php-clean-architecture

PHP Clean Architecture

14661.8k](/packages/vchetkov-php-clean-architecture)

PHPackages © 2026

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