Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Laravel News:
Checking the Code Complexity of your App
Jan 11, 2017 @ 11:52:58

On the Laravel News site there's an article posted showing you how to determine the complexity of your application using the phploc tool from Sebastian Bergmann.

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.

tagged: code complexity tool phploc phpmetrics example composer tutorial

Link: https://laravel-news.com/code-complexity-tools