Laravel Stats (alpha)

Laravel Stats provides code metrics from Laravel projects around the community. This is done in an effort to open analytics data from Shift and help guide development through data-driven decisions.

To contribute by sharing your project stats, you may run the Laravel Linter or install v2.3.0 of laravel-stats and run it with the --share option. All shared data is kept private. Only the aggregated metrics are used to generate this stats dashboard.


Overall Stats

Projects tracked so far
1,113
Avg. Lines of Code
4,064.1
Avg. Classes
202

Controllers

Controllers are one of the primary components of Laravel. As such, they may have higher averages than other components.

Yet, more than several methods per class may indicate an opportunity to split a controller apart. In addition, high lines of code may be an opportunity to use other components.

Resources

Avg. Classes
25
Avg. Lines of Code
15.8
Avg. Methods per Controller
3.3
Avg. Lines per Method
4.2
96%
of projects use Controllers

Models

Models are another core component within Laravel. While the averages may appear reasonable, individual models tend to fall at the extremes. That is some models may be empty classes, while others are very large.

If you follow the fat models philosophy, then higher numbers may be acceptable. Otherwise, they may be an opportunity to use other components or traits to break up large models.

Resources

Avg. Classes
17
Avg. Lines of Code
9.3
Avg. Methods per Model
3.6
Avg. Lines per Method
2.5
belongsTo
is the most used relationship

Folder Structure

This section includes metrics on the app folder structure within Laravel applications. Note: The Top 5 list excludes folders provided in, or generated by, a default Laravel application.

Top 5
  1. app/Services 35%
  2. app/Traits 29%
  3. app/Nova 22%
  4. app/Helpers 22%
  5. app/Exports 19%
56%
of projects use a models folder

Packages

The section outlines the average number of packages used within Laravel applications, as well as lists the Top 5 most used packages.

Note: This list does not include packages required in a default Laravel application.

Resources

Last updated Friday, September 25th, 2020 at 1:38pm UTC