annamint.blogg.se

Php file line count
Php file line count













  1. PHP FILE LINE COUNT CODE
  2. PHP FILE LINE COUNT DOWNLOAD

It can also pull from archives and git repositories, diff two versions of a codebase, pull from specific commits, ignore files and folders matching specific patterns, and it's installable via Brew, NPM, two Windows package managers, and all the major Linux package managers. It can differentiate languages and also separate empty lines and comment lines against real lines of code. Here's what I used: php phploc.phar -exclude vendor -exclude node_modules myprojectĬLOC is one of the longer-running and smartest programs for counting lines of code. phar, run it, then delete it once you're done.

PHP FILE LINE COUNT DOWNLOAD

You can require it globally or project-specific with Composer, or, my preferred method, just download the.

PHP FILE LINE COUNT CODE

Logical Lines of Code (LLOC) 377 (20.03%) Non-Comment Lines of Code (NCLOC) 1627 (86.45%) Here's a sample PHPLOC report: $ phploc srcĬomment Lines of Code (CLOC) 255 (13.55%) PHPLOC also gives other PHP-specific metrics, like cyclomatic complexity, number of classes, average class length, average method length, and more. PHPLOC is a project from Sebastian Bergmann, the creator of PHPUnit, which gives simple and easy LOC counts contextualized for PHP.

php file line count

When possible, I've passed filters to them to just count PHP files. Please note that some of these tools count all lines of code, not just PHP.

php file line count

Note that you can also exclude framework-specific cache and log directories and whatever else helps you get the best number. Grab the Non-Comment Lines of Code and Logical Lines of Code numbers they'll be your most useful comparisons across projects. Php phploc-4.0.1.phar -exclude vendor -exclude node_modules myprojectnamehere/ You can find a longer description below, but here's the quick start guide: cd Sites/

php file line count

If you don't want to read a half dozen options, use PHPLOC. If you were to ask me, I would say we shouldn't even think about it. It turns out that's actually a much harder number to discover than you might think, so I figured I would write up a few options here.įor what it's worth, I'm not a big fan of LOC as a measure of any importance, but it can at least give us some broad foundations to use to talk about broad differences in project size. I'm giving a talk soon about Laravel and "the enterprise", and the concept of LOC (lines of code) keeps coming up.















Php file line count