sebastianbergmann / phploc

A tool for quickly measuring the size of a PHP project.

This URL has Read+Write access

Mon Jan 26 09:00:39 -0800 2009
commit  b928ab037c01ba83b7fb1486de59fb25ecc900fd
tree    f6f7b6f50798f91a1a088da1a9b19562b0f79e58
parent  3203a3efdf0faf4edb3dd31e49d1e1bc3c5d0790
phploc /
name age message
directory PHPLOC/ Loading commit data...
file README.markdown
file package.xml
file phploc.bat Thu Jan 22 03:17:39 -0800 2009 Initial import. [sebastianbergmann]
file phploc.php Thu Jan 22 09:19:49 -0800 2009 Reorganize. [sebastianbergmann]
README.markdown

phploc

phploc is a tool for quickly measuring the size of a PHP project.

The goal of phploc is not not to replace more sophisticated tools such as phpcs, pdepend, or phpmd, but rather to provide an alternative to them when you just need to get a quick understanding of a project's size.

Requirements

  • The tokenizer extension is required to count the Comment Lines of Code (CLOC) and Non-Comment Lines of Code (NCLOC) as well as the number of interfaces, classes, methods, and functions of a project.
  • The parsekit extension is an optional requirement and is used to count the Executable Lines of Code (ELOC) of a project.

Installation

phploc should be installed using the PEAR Installer. This installer is the backbone of PEAR, which provides a distribution system for PHP packages, and is shipped with every release of PHP since version 4.3.0.

The PEAR channel (pear.phpunit.de) that is used to distribute phploc needs to be registered with the local PEAR environment:

sb@ubuntu ~ % pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded

This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel:

sb@ubuntu ~ % pear install phpunit/phploc
downloading phploc-1.0.0.tgz ...
Starting to download phploc-1.0.0.tgz (5,834 bytes)
.....done: 5,834 bytes
install ok: channel://pear.phpunit.de/phploc-1.0.0

After the installation you can find the phploc source files inside your local PEAR directory; the path is usually /usr/lib/php/PHPLOC.

Usage Example

sb@ubuntu ~ % phploc /usr/local/src/phpunit/trunk 
phploc 1.0.0 by Sebastian Bergmann.

Directories:                               51
Files:                                    335

Lines of Code (LOC):                    60733
Executable Lines of Code (ELOC):        22378
Comment Lines of Code (CLOC):           25820
Non-Comment Lines of Code (NCLOC):      34913

Interfaces:                                31
Classes:                                  303
Functions/Methods:                       2062