PHPackages                             mfn/php-analyzer - 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. mfn/php-analyzer

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

mfn/php-analyzer
================

Framework for performaing static PHP code analysis

v0.0.2(11y ago)334MITPHPPHP &gt;=5.4.0

Since Feb 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mfn/php-analyzer)[ Packagist](https://packagist.org/packages/mfn/php-analyzer)[ Docs](http://github.com/mfn/php-analyzer)[ RSS](/packages/mfn-php-analyzer/feed)WikiDiscussions master Synced 4w ago

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

PHP-Analzyer
============

[](#php-analzyer)

Homepage:

Blurb
-----

[](#blurb)

A [framework](doc/framework.md) for performing static PHP source analysis. The modular concept hands analysis over to [Analyzers](doc/analyzers.md) which report back any possible warnings/errors.

Install
-------

[](#install)

Via [composer](https://getcomposer.org):

```
composer require mfn/php-analyzer 0.0.1

```

Usage
-----

[](#usage)

A command line tool is provided: `php_analyzer.php analyze `

See the `--help` switch for more details.

What analysis is performed?
===========================

[](#what-analysis-is-performed)

All files are run through the [nikic/PHP-Parser](https://github.com/nikic/PHP-Parser)and after that an internal graph of the classes/interfaces is built.

All analyzers available are run against the sources reports are generated.

The following analysis is currently performed:

- detection of missing method implementations of abstract classes
- detecting of missing method implementations of interfaces
- incompatibility of methods declared in interfaces
- methods defined abstract on an interface
    Probably a bit pointless because the php linter detects this.
- warns when using dynamic class instantiation, i.e. `new $foo`
- warns when encountering empty exception catch blocks

Learn more:

- [The architecture of the Framework itself](doc/framework.md)
- [Documentations of all Analyzers](doc/analyzers.md)
- [Default Analyzer configuration](res/defaultAnalyzerConfiguration.php)

Graphviz
--------

[](#graphviz)

The internal [ObjectGraph](lib/Analyzers/ObjectGraph/ObjectGraph.php) lends itself to generate a class relationship diagram for which a graphviz generator exists. This will produce a `.dot` file which can be further used with the [Graphviz](http://www.graphviz.org/) package to generate graphics from it:

`php_analyzer.php graphviz yoursource/ > myproject.dot`

See `--help` for more options.

To convert this to e.g. png the aforementioned graphviz package has to be installed on your system. This includes the `dot` command which can be used to generate a PNG file:

`dot -Tpng myproject.dot > myproject.png`

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

[](#configuration)

If you want to use a differnet set of analyzers or you've written your own and want to use them, you can use the `--config ` option.

The file is a plain PHP file simply returning an array of analyzers you want to run. See [res/defaultAnalyzerConfiguration.php](res/defaultAnalyzerConfiguration.php)for an example.

TODOs / Ideas
=============

[](#todos--ideas)

- the analyzers depending on the graph have no logic whether they've visited a node already or not; thus visiting the same nodes/methods multiple times
- Use `namespacedName` property generated by `\PhpParser\NodeVisitor\NameResolver`
- Add support for traits

Contribution
============

[](#contribution)

- one feature per branch/PR
- coding standard is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)

© Markus Fischer

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Every ~0 days

Total

2

Last Release

4205d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f0d4e7638e419a48dde77f4c481fb1eb2dbe8f5fe913e68e26269ee7e051ade?d=identicon)[mfn](/maintainers/mfn)

---

Top Contributors

[![mfn](https://avatars.githubusercontent.com/u/87493?v=4)](https://github.com/mfn "mfn (36 commits)")

---

Tags

codeanalysissource

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mfn-php-analyzer/health.svg)

```
[![Health](https://phpackages.com/badges/mfn-php-analyzer/health.svg)](https://phpackages.com/packages/mfn-php-analyzer)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k199.6M3.3k](/packages/composer-composer)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M353](/packages/psalm-plugin-laravel)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k30.0M2.7k](/packages/infection-infection)[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k148.6M654](/packages/zircote-swagger-php)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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