Download the PHP package hertel/phploc without Composer
On this page you can find all versions of the php package hertel/phploc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hertel/phploc
More information about hertel/phploc
Files in hertel/phploc
Package phploc
Short Description A tool for quickly measuring the size of a PHP project.
License BSD-3-Clause
Homepage https://github.com/sebastianbergmann/phploc
Informations about the package phploc
PHPLOC
phploc is a tool for quickly measuring the size of a PHP project.
About this fork
PHPLOC was created and maintained by Sebastian Bergmann as
phploc/phploc from 2009 onwards, until he stopped maintaining it and
kept the repository for archival purposes. Every idea, every metric, and the shape of the report are his work, and this
fork stands entirely on it. Thank you, Sebastian.
This fork exists for one reason: OSS Complexity Report runs
phploc at its core, so the tool needs a maintained home. It is published as hertel/phploc and maintained by
Christopher Hertel, under the original BSD-3-Clause license with the original copyright
notice intact.
That purpose is what this fork is built around, and it is worth being explicit about what it means, because it is not the same as continuing the original project:
- It is shaped by one consumer. Decisions are made for what the OSS Complexity Report needs — measuring many open
source packages, unattended, and comparing the numbers over time. Where the original left a choice to the user, this
fork tends to pick one behaviour and keep it. The
--suffix,--exclude,--debug, and--count-testsoptions are gone for that reason, and so are the CSV and XML logs;--jsoncovers machine-readable output. - Test code is separated from production code by default. A size or complexity number that mixes a project's tests into its production code says little about either, so test classes and test methods are reported on their own.
- It measures the syntax tree, not the token stream. The original scanned tokens, which could not see enums,
anonymous classes, or arrow functions, and could not tell a property access from a method call. Everything is parsed
with
nikic/php-parsernow, which is also why some numbers differ from the ones the original reported for the same code. - The measurements are still not this project's own work. Lines of code and cyclomatic complexity come from
Sebastian Bergmann's
sebastian/lines-of-codeandsebastian/complexitylibraries. This tool decides what to count and how to group it; those libraries decide what a logical line and a decision point are. - It is not a drop-in replacement. The class names live in the
Hertel\PhpLocnamespace so that both packages can be installed side by side, the tool is a Composer dependency rather than a PHAR, and it requires PHP 8.4. SeeChangeLog.mdfor everything that changed.
If you want the original, unchanged, use phploc/phploc. If you want a phploc that is still maintained and is happy
to keep moving, use this one.
This fork is not affiliated with, supported by, or endorsed by Sebastian Bergmann. Please report issues with it here, never to the original project.
Installation
This tool is installed using Composer:
Pass --json to get the result as JSON instead of as the text report, for example to feed it into another tool:
Usage Example
Test classes and test methods are always reported in the Tests section of their own instead of being measured as
production code, so pointing phploc at a whole project keeps the numbers about the production code:
Test classes of PHPUnit, Codeception, and PhpSpec are recognised, as are Pest files, in which every file that declares
tests counts as one test class and every test() / it() call as one test method.
All versions of phploc with dependencies
ext-dom Version *
ext-json Version *
sebastian/cli-parser Version ^1.0
sebastian/version Version ^3.0
phpunit/php-file-iterator Version ^3.0