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 3w 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 31% 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

4160d 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.6k38.2k](/packages/matomo-matomo)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[phpro/soap-client

A general purpose SoapClient library

8895.9M52](/packages/phpro-soap-client)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[v.chetkov/php-clean-architecture

PHP Clean Architecture

14659.9k](/packages/vchetkov-php-clean-architecture)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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