PHPackages                             hgraca/phorensic - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. hgraca/phorensic

ActiveLibrary[Testing &amp; Quality](/categories/testing)

hgraca/phorensic
================

A static analysis tool to gather a few metrics, like what code should have priority in refactoring.

76[1 PRs](https://github.com/hgraca/php-phorensic/pulls)PHP

Since Jan 3Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hgraca/php-phorensic)[ Packagist](https://packagist.org/packages/hgraca/phorensic)[ RSS](/packages/hgraca-phorensic/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Hgraca\\Phorensic
=================

[](#hgracaphorensic)

[![Author](https://camo.githubusercontent.com/e80528a6fbd7a1766b221b1a32d700b339f6a1992a8e0a1f602d24c256c74d66/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406867726163612d626c75652e7376673f7374796c653d666c61742d737175617265)](https://www.herbertograca.com)[![Software License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Latest Version](https://camo.githubusercontent.com/435e4d10183b412f6f5b97c1db981d3aecdc389a15f0324f3e5e9846e011dc21/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6867726163612f7068702d70686f72656e7369632e7376673f7374796c653d666c61742d737175617265)](https://github.com/hgraca/php-phorensic/releases)[![Total Downloads](https://camo.githubusercontent.com/af063a5168f97b28235332c5c35b2bae984f740a9f68894f172c98147c8e92e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6867726163612f70686f72656e7369632e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hgraca/phorensic)

[![Build Status](https://camo.githubusercontent.com/b0091ee954c88dab06b7d45e01e07bd9e631915b559a71f20e9e1da1f74fa28e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f6867726163612f7068702d70686f72656e7369632e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/hgraca/php-phorensic/build)[![Coverage Status](https://camo.githubusercontent.com/f55926ec775fd020c947894345c23da10dc208ba88f564b9cc7bc6159b6bf0c2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6867726163612f7068702d70686f72656e7369632e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/hgraca/php-phorensic/code-structure)[![Quality Score](https://camo.githubusercontent.com/5917cae0c6fddb0ff8867e71ba04beef1b22fd23b4110a3687aadc73e90fc09b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6867726163612f7068702d70686f72656e7369632e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/hgraca/php-phorensic)

A static analysis tool to gather a few metrics, like what code should have priority in refactoring.

The metrics aimed for are:

- Hotspots detection (complexity \* change\_rate)
    - Prioritize code for refactoring
- Code units temporal coupling
    - If there is no reason for them to change together (unlike tests and the code they test), they should probably be refactored
- Code units ownership analysis
    - To detect team knowledge deficiencies

Usage
-----

[](#usage)

This tool works in 2 steps:

1. Mine the project for data, which is put in a sqlite DB
    - `phorensic:extract [] [] []`
2. Query a sqlite DB for information
    - `phorensic:analyse  []`

So, for example:

```
bin/run phorensic:extract /opt/my_project "last month" "./analyse_2016-12-20_23:51:36.sqlite"
bin/run phorensic:analyse "./analyse_2016-12-20_23:51:36.sqlite" 20
```

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

[](#installation)

To install the library, run the command below and you will get the latest version:

```
composer require hgraca/phorensic

```

Tests
-----

[](#tests)

To run the tests run:

```
make test
```

Or just one of the following:

```
make test-acceptance
make test-functional
make test-integration
make test-unit
make test-humbug
```

To run the tests in debug mode run:

```
make test-debug
```

Coverage
--------

[](#coverage)

To generate the test coverage run:

```
make coverage
```

Code standards
--------------

[](#code-standards)

To fix the code standards run:

```
make cs-fix
```

Todo
----

[](#todo)

- Create Builder class so that we can do dep inj with the commands and make them testable
- Test the commands

- Create command to find classes with temporal-coupling
- Create command to find specific class ownership
- Create command to find specific package ownership
- Create command to find ownership analysis (ownership fractals)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![hgraca](https://avatars.githubusercontent.com/u/1809002?v=4)](https://github.com/hgraca "hgraca (6 commits)")

### Embed Badge

![Health badge](/badges/hgraca-phorensic/health.svg)

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

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14429.2M357](/packages/dms-phpunit-arraysubset-asserts)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.5k2](/packages/phpbenchmark-phpbenchmark)

PHPackages © 2026

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