PHPackages                             trismegiste/mondrian - 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. trismegiste/mondrian

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

trismegiste/mondrian
====================

Mondrian is a set of static analysis and refactoring tools for more abstraction

v1.3.3(11y ago)39318522[9 issues](https://github.com/Trismegiste/Mondrian/issues)CC-BY-SA-3.0PHPPHP &gt;=5.4

Since May 10Pushed 4y ago24 watchersCompare

[ Source](https://github.com/Trismegiste/Mondrian)[ Packagist](https://packagist.org/packages/trismegiste/mondrian)[ RSS](/packages/trismegiste-mondrian/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (8)Used By (0)

Mondrian [![Build Status](https://camo.githubusercontent.com/f2c5b997b9b8f549532754e6e5a3b5956f168fcf40a1e69b9ee9cbb1c24f909f/68747470733a2f2f7472617669732d63692e6f72672f547269736d6567697374652f4d6f6e647269616e2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/Trismegiste/Mondrian)
====================================================================================================================================================================================================================================================================================================

[](#mondrian-)

Ok guyz, you have a master degree in [Graph Theory](http://en.wikipedia.org/wiki/Graph_theory), you follow [Law of Demeter](http://en.wikipedia.org/wiki/Law_of_Demeter)and you live on [S.O.L.I.D](http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)) principles ?

Let's have some Fun ! (^ω^)

What
----

[](#what)

It is a set of CLI tools to help you to analyse and refactor highly coupled classes. As you know Law of Demeter and S.O.L.I.D guidances, you need your classes loosely coupled. And for this, there is one only rule : **ABSTRACTION**

[![From Hell To Kiss](./doc/img/abstracting.png)](./doc/img/abstracting.png)

This app provides some helpers to add abstraction into concrete classes with minimum pain.

Getting started
---------------

[](#getting-started)

Download the PHAR : [mondrian.phar](https://github.com/Trismegiste/Mondrian/raw/master/bin/box/mondrian.phar)

Try to run a simple command with a few files (or a small part of a project)

```
$ mondrian.phar digraph /home/dev/project

```

This command produces a DOT file for [GraphViz](http://www.graphviz.org). Other formats are available :

- html : interactive graph with the d3.js awesome library
- svg : open standard for vector graphics (requires [GraphViz](http://www.graphviz.org/Download..php))
- json : format for d3.js for example

### Example with html format

[](#example-with-html-format)

```
$ php mondrian.php d --ignore=tests --ignore=vendor --format=html ./MyPhpProject/

```

[![html-report](./doc/img/sample-d3js.png)](./doc/img/sample-d3js.png)

Note: The generated html file does not require any dependencies nor a connection.

Ecosystem
---------

[](#ecosystem)

Running unit tests with [PHPUnit](https://phpunit.de/getting-started.html)

```
$ phpunit.phar

```

Building the documentation with [phpDocumentor](http://phpdoc.org/docs/latest/getting-started/installing.html#phar)

```
$ phpDocumentor.phar

```

Building mondrian.phar from the sources with [box2](https://github.com/box-project/box2#as-a-phar-recommended)

```
$ box.phar b

```

Examples
--------

[](#examples)

### Default digraph on trismegiste/dokudoki

[](#default-digraph-on-trismegistedokudoki)

[![digraph1](./doc/img/sample1.jpg)](./doc/img/sample1.jpg)

### Which components are bottleneck ?

[](#which-components-are-bottleneck-)

[![digraph2](./doc/img/sample2.jpg)](./doc/img/sample2.jpg)

### Reduced graph to LSP violations on trismegiste/prolog

[](#reduced-graph-to-lsp-violations-on-trismegisteprolog)

[![digraph3](./doc/img/sample3.jpg)](./doc/img/sample3.jpg)

How
---

[](#how)

Read the concept [here](./doc/README.md)

Read the online documentation [here](http://trismegiste.github.io/Mondrian/)

And the API [here](http://trismegiste.github.io/Mondrian/doc/index.html) (not up to date)

Extensible
----------

[](#extensible)

You can easily add plugins to this tool to make your own algorithm, coloring scheme or new generator. I try to make the API mostly decoupled, re-usable and with great SRP and OCP concerns. Look into the "About" plugin to understand a basic stub of plugin.

Third party
-----------

[](#third-party)

Packages used in this project :

- [nikic/php-parser](https://github.com/nikic/PHP-Parser) for parsing PHP
- [symfony/console](https://github.com/symfony/Console) for creating CLI app with swag
- [alom/graphviz](https://github.com/alexandresalome/graphviz) for rendering DOT files
- [symfony/finder](https://github.com/symfony/Finder) for searching files through filesystem
- [symfony/config](https://github.com/symfony/Config) for managing yaml configuration without headache
- [D3.js](http://d3js.org/) for graph rendering in html
- Phar builded with [Box](https://github.com/kherge/Box)

Special thanks
--------------

[](#special-thanks)

- William Gibson
- JS Bach
- Dream Theater

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 97.2% 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 ~98 days

Recently: every ~1 days

Total

6

Last Release

4253d ago

PHP version history (2 changes)1.1.0PHP &gt;=5.3.8

v1.3.1PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/64cc99ca21a090b2454784670e4ac49db17794d6861078eeceebdbe302365c3f?d=identicon)[trismegiste](/maintainers/trismegiste)

---

Top Contributors

[![Trismegiste](https://avatars.githubusercontent.com/u/1260026?v=4)](https://github.com/Trismegiste "Trismegiste (105 commits)")[![sebastianbergmann](https://avatars.githubusercontent.com/u/25218?v=4)](https://github.com/sebastianbergmann "sebastianbergmann (2 commits)")[![tothimre](https://avatars.githubusercontent.com/u/74795412?v=4)](https://github.com/tothimre "tothimre (1 commits)")

---

Tags

refactoringcodeMetricsstaticanalysisgraphabstract

### Embed Badge

![Health badge](/badges/trismegiste-mondrian/health.svg)

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

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M563](/packages/symfony-maker-bundle)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M81](/packages/symplify-monorepo-builder)[sculpin/sculpin

Static Site Generator

1.5k102.8k12](/packages/sculpin-sculpin)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

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