Yesterday, Taylor made a post comparing the code complexity between Laravel and other frameworks. The tool he used to generate these reports is called phploc and it’s very easy to run on your own code base.
I decided as a means of comparison I would run that on the codebase for this site and just see what the results are.
The tutorial walks you through the installation of the tool (as a globally installed Composer package), how to execute it and what the results look like. These results include a lot of data including:
- Average Class Length
- Average Complexity per LLOC
- (Use of) Global Constants
- (Number of) Namespaces
phploc is useful for getting the overall numbers but he wanted something a bit more specific. For that he chose the PhpMetrics package that allows for deeper introspection into files and classes in your code to locate the complexity and find spots for refactoring.