PHPackages                             silverfoxy/php-cfg - 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. silverfoxy/php-cfg

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

silverfoxy/php-cfg
==================

A fork of Control Flow Graph implementation for PHP with meta stats information

v0.5.0(7y ago)1102BSDPHPPHP ^7.0

Since Feb 23Pushed 3y agoCompare

[ Source](https://github.com/silverfoxy/php-cfg)[ Packagist](https://packagist.org/packages/silverfoxy/php-cfg)[ RSS](/packages/silverfoxy-php-cfg/feed)WikiDiscussions master Synced 3w ago

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

[![Build Status](https://github.com/ircmaxell/php-cfg/actions/workflows/main.yml/badge.svg)](https://github.com/ircmaxell/php-cfg/actions)[![Latest Stable Version](https://camo.githubusercontent.com/9a6f615988dae2bf55c2a56596f23ecd564c62dd03dab7159763d459f5f43556/68747470733a2f2f706f7365722e707567782e6f72672f6972636d6178656c6c2f7068702d6366672f762f737461626c65)](https://packagist.org/packages/ircmaxell/php-cfg)

PHP-CFG
=======

[](#php-cfg)

Pure PHP implementation of a control flow graph (CFG) with instructions in static single assignment (SSA) form.

The used SSA construction algorithm is based on "Simple and Efficient Construction of Static Single Assignment Form" by Braun et al. This algorithm constructs SSA form directly from the abstract syntax tree, without going through a non-SSA IR first. If you're looking for dominance frontiers, you won't find them here...

The constructed SSA form is minimal and pure (or is supposed to be).

Usage
-----

[](#usage)

To bootstrap the parser, you need to give it a `PhpParser` instance:

```
$parser = new PHPCfg\Parser(
    (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7)
);
```

Then, just call parse on a block of code, giving it a filename:

```
$script = $parser->parse(file_get_contents(__FILE__), __FILE__);
```

To dump the graph, simply use the built-in dumper:

```
$dumper = new PHPCfg\Printer\Text();
echo $dumper->printScript($script);
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~8 days

Total

3

Last Release

2669d ago

Major Versions

v0.5.x-dev → v1.0.x-dev2019-03-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/d19a284c1db4cd570fbf642f18a6175f9b47479d0054c6c29cd5f87a843ac97f?d=identicon)[silverfoxy](/maintainers/silverfoxy)

---

Top Contributors

[![ircmaxell](https://avatars.githubusercontent.com/u/660654?v=4)](https://github.com/ircmaxell "ircmaxell (114 commits)")[![nikic](https://avatars.githubusercontent.com/u/216080?v=4)](https://github.com/nikic "nikic (70 commits)")[![mwijngaard](https://avatars.githubusercontent.com/u/273701?v=4)](https://github.com/mwijngaard "mwijngaard (14 commits)")[![eric-therond](https://avatars.githubusercontent.com/u/11455652?v=4)](https://github.com/eric-therond "eric-therond (14 commits)")[![silverfoxy](https://avatars.githubusercontent.com/u/1313190?v=4)](https://github.com/silverfoxy "silverfoxy (8 commits)")[![PavelJurasek](https://avatars.githubusercontent.com/u/1270132?v=4)](https://github.com/PavelJurasek "PavelJurasek (4 commits)")[![LioTree](https://avatars.githubusercontent.com/u/12847578?v=4)](https://github.com/LioTree "LioTree (4 commits)")[![royopa](https://avatars.githubusercontent.com/u/442991?v=4)](https://github.com/royopa "royopa (2 commits)")[![ovr](https://avatars.githubusercontent.com/u/572096?v=4)](https://github.com/ovr "ovr (2 commits)")[![salmonx](https://avatars.githubusercontent.com/u/8596646?v=4)](https://github.com/salmonx "salmonx (1 commits)")[![samnela](https://avatars.githubusercontent.com/u/1852108?v=4)](https://github.com/samnela "samnela (1 commits)")[![sergeyklay](https://avatars.githubusercontent.com/u/1256298?v=4)](https://github.com/sergeyklay "sergeyklay (1 commits)")[![fntlnz](https://avatars.githubusercontent.com/u/3083633?v=4)](https://github.com/fntlnz "fntlnz (1 commits)")[![SZFsir](https://avatars.githubusercontent.com/u/24249321?v=4)](https://github.com/SZFsir "SZFsir (1 commits)")[![villfa](https://avatars.githubusercontent.com/u/2891564?v=4)](https://github.com/villfa "villfa (1 commits)")[![leestephenn](https://avatars.githubusercontent.com/u/4571662?v=4)](https://github.com/leestephenn "leestephenn (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silverfoxy-php-cfg/health.svg)

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

###  Alternatives

[deptrac/deptrac

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

3.0k8.8M115](/packages/deptrac-deptrac)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[beyondcode/laravel-er-diagram-generator

Generate ER diagrams from your Laravel models.

2.0k1.5M2](/packages/beyondcode-laravel-er-diagram-generator)[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

6003.7M96](/packages/roave-backward-compatibility-check)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4814.0M25](/packages/coenjacobs-mozart)

PHPackages © 2026

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