PHPackages                             phpexperts/phploc-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. phpexperts/phploc-analyzer

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

phpexperts/phploc-analyzer
==========================

A way to easily get phploc stats into your program.

v1.1.1(5y ago)4412[1 PRs](https://github.com/phpexpertsinc/PHPLOCAnalyzer/pulls)MITPHPPHP &gt;=7.3CI failing

Since May 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/phpexpertsinc/PHPLOCAnalyzer)[ Packagist](https://packagist.org/packages/phpexperts/phploc-analyzer)[ Docs](https://www.phpexperts.pro/)[ RSS](/packages/phpexperts-phploc-analyzer/feed)WikiDiscussions master Synced 1w ago

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

PHPLOCAnalyzer Project
======================

[](#phplocanalyzer-project)

[![TravisCI](https://camo.githubusercontent.com/5bcab0b48664654b8516fe1ca0b117bd61570b53f14b3888fb257e45abaf281d/68747470733a2f2f7472617669732d63692e6f72672f70687065787065727473696e632f5048504c4f43416e616c797a65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/phpexpertsinc/PHPLOCAnalyzer)[![Test Coverage](https://camo.githubusercontent.com/e75dddb6683d777eada35646865b24738d5eb00e2a207cefdc9348c14f1f6832/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f64303431303665616362623461346561346135352f746573745f636f766572616765)](https://codeclimate.com/github/phpexpertsinc/PHPLOCAnalyzer/test_coverage)

**I made a timelapse of the creation of this project up to v1.0.0.****You can watch it at [https://www.youtube.com/watch?v=BlYdIxj\_A6A](https://www.youtube.com/watch?v=BlYdIxj_A6A)**

PHPLOCAnalyzer is a PHP Experts, Inc., Project meant to automate the reporting from [sebastianbergmann/phploc](https://github.com/sebastianbergmann/phploc).

It turns this

```
Size
  Lines of Code (LOC)                              687
  Comment Lines of Code (CLOC)                     143 (20.82%)
  Non-Comment Lines of Code (NCLOC)                544 (79.18%)
  Logical Lines of Code (LLOC)                     188 (27.37%)
    Classes                                        168 (89.36%)
      Average Class Length                          42
        Minimum Class Length                        10
        Maximum Class Length                        94
      Average Method Length                          3
        Minimum Method Length                        0
        Maximum Method Length                       11
    Functions                                        0 (0.00%)
      Average Function Length                        0
    Not in classes or functions                     20 (10.64%)

Cyclomatic Complexity
  Average Complexity per LLOC                     0.42
  Average Complexity per Class                   20.75
    Minimum Class Complexity                      1.00
    Maximum Class Complexity                     44.00
  Average Complexity per Method                   3.06
    Minimum Method Complexity                     1.00
    Maximum Method Complexity                    15.00

Dependencies
  Global Accesses                                    0
    Global Constants                                 0 (0.00%)
    Global Variables                                 0 (0.00%)
    Super-Global Variables                           0 (0.00%)
  Attribute Accesses                                55
    Non-Static                                      55 (100.00%)
    Static                                           0 (0.00%)
  Method Calls                                      47
    Non-Static                                      41 (87.23%)
    Static                                           6 (12.77%)

Structure
  Namespaces                                         1
  Interfaces                                         1
  Traits                                             1
  Classes                                            2
    Abstract Classes                                 2 (100.00%)
    Concrete Classes                                 0 (0.00%)
  Methods                                           46
    Scope
      Non-Static Methods                            46 (100.00%)
      Static Methods                                 0 (0.00%)
    Visibility
      Public Methods                                30 (65.22%)
      Non-Public Methods                            16 (34.78%)
  Functions                                          2
    Named Functions                                  0 (0.00%)
    Anonymous Functions                              2 (100.00%)
  Constants                                          3
    Global Constants                                 0 (0.00%)
    Class Constants                                  3 (100.00%)

```

into this:

```
{
    "directories": 2,
    "files": 12,
    "size": {
        "loc": 1870,
        "loc_comments": 383,
        "loc_noncomment": 1487,
        "loc_logical": 454,
        "loc_global_scope": 67,
        "classes": 385,
        "class_length_avg": 32,
        "class_length_min": 1,
        "class_length_max": 94,
        "method_length_avg": 4,
        "method_length_min": 0,
        "method_length_max": 17,
        "functions": 2,
        "function_length_avg": 0
    },
    "cyclomatic": {
        "lloc": 0.22,
        "class_avg": 9.33,
        "class_min": 1,
        "class_max": 44,
        "method_avg": 2.1,
        "method_min": 1,
        "method_max": 15
    },
    "dependencies": {
        "global_constants": 0,
        "global_variables": 0,
        "super_globals": 0,
        "attributes_nonstatic": 85,
        "attributes_static": 0,
        "methodcalls_nonstatic": 128,
        "methodcalls_static": 73
    },
    "structure": {
        "namespaces": 3,
        "interfaces": 1,
        "traits": 1,
        "classes_abstract": 2,
        "classes_concrete": 8,
        "methods_scope_nonstatic": 95,
        "methods_scope_static": 0,
        "visibility_public": 72,
        "visibility_nonpublic": 23,
        "functions_named": 0,
        "functions_anonymous": 3,
        "constants_global": 0,
        "constants_class": 3
    }
}
```

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

[](#installation)

Via Composer

```
composer require phpexperts/phploc-analyzer
```

Usage
-----

[](#usage)

```
use \PHPExperts\PHPLOCAnalyzer\PHPLOCAnalyzer;
$phplocDTO = PHPLOCAnalyzer::analyze('/code/path');
echo json_encode($phplocDTO, JSON_PRETTY_PRINT);
```

Testing
-------

[](#testing)

```
phpunit --testdox
```

Contributors
============

[](#contributors)

[Theodore R. Smith](https://www.phpexperts.pro/%5D)
GPG Fingerprint: 4BF8 2613 1C34 87AC D28F 2AD8 EB24 A91D D612 5690
CEO: PHP Experts, Inc.

License
-------

[](#license)

MIT license. Please see the [license file](LICENSE) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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

Total

3

Last Release

2024d ago

PHP version history (2 changes)v1.0.0PHP ^7.2

v1.1.0PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/3f3a2dd16766f6b03c330e65aaca9dfb97f1bbbb41c5e2af5681f58f670b7917?d=identicon)[hopeseekr](/maintainers/hopeseekr)

---

Top Contributors

[![hopeseekr](https://avatars.githubusercontent.com/u/1125541?v=4)](https://github.com/hopeseekr "hopeseekr (10 commits)")

---

Tags

code analysisphploc

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpexperts-phploc-analyzer/health.svg)

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

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[wapmorgan/php-code-analyzer

A program that finds usage of different non-built-in extensions in your php code.

96143.2k4](/packages/wapmorgan-php-code-analyzer)[ffi/var-dumper

List of symfony/var-dumper casters with FFI support

2010.7k4](/packages/ffi-var-dumper)[avency/neos-vardump

Neos VarDump Package

147.1k](/packages/avency-neos-vardump)[salehhashemi/laravel-intelli-git

An intelligent Git helper package for Laravel applications. It utilizes OpenAI's GPT to analyze your Git repository, providing features such as automatic generation of commit messages based on staged changes.

131.5k](/packages/salehhashemi-laravel-intelli-git)

PHPackages © 2026

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