Flat-first CMS built as a Laravel Composer package, storing content in flat files with Git support.
stefanzweifel/laravel-stats
A Composer dev package for Laravel and Lumen that counts your app's code and classifies classes by Laravel component.
- Stars
- 1,741
- Forks
- 84
- Open issues
- 0
- Last commit
- 14 days ago
What is it?
Laravel Stats is a Composer package that scans a Laravel or Lumen project and produces an overview of its codebase. It reports how much code the application contains and breaks the classes down by Laravel component, such as controllers, models, jobs, migrations, and Livewire components.
Classification is based on what each class extends, implements, or uses, plus checks such as whether a controller is registered with a route or a policy is registered in the auth service provider. The scanned paths come from the package config file. You can also write custom classifiers that implement the Classifier contract to group your own component types, such as repositories.
The command runs as `php artisan stats`, with `--json` for machine-readable output and `--verbose` to show which classes fall into each component. Tests written with Pest are excluded from the statistics.
Key features
- 01Counts lines of code for application code and tests.
- 02Groups classes by Laravel component such as controllers, models, and jobs.
- 03Outputs results as a table or JSON.
- 04Verbose mode lists which classes belong to each component.
- 05Supports custom classifiers for application-specific component types.
Use cases
- Getting a quick overview of a legacy Laravel codebase's structure.
- Tracking how the number of components in an application changes over time.
- Feeding project statistics into scripts or reports via JSON output.
Quick start
- 1
Install the package as a dev dependency with Composer
composer require "wnx/laravel-stats" --dev - 2
Clear the config cache before running (recommended)
php artisan config:clear - 3
Generate the statistics in your Laravel project
php artisan stats
Things to know
- Targets Laravel and Lumen projects only, so it is not useful for other PHP frameworks.
- Pest PHP tests cannot currently be detected and are excluded from the statistics.
In collections
Topics
FAQ
- What is laravel-stats?
- A Composer dev package for Laravel and Lumen that counts your app's code and classifies classes by Laravel component. Laravel Stats is a Composer package that scans a Laravel or Lumen project and produces an overview of its codebase. It reports how much code the application contains and breaks the classes down by Laravel component, such as controllers, models, jobs, migrations, and Livewire components.
- Is laravel-stats free to use? What license does it have?
- laravel-stats is open source under the MIT license. Check the license terms before using it in commercial products.
- Is laravel-stats still maintained?
- Actively maintained. The last commit to laravel-stats was on Oct 24, 2026.
- What can I use laravel-stats for?
- Getting a quick overview of a legacy Laravel codebase's structure. Tracking how the number of components in an application changes over time. Feeding project statistics into scripts or reports via JSON output.
- How do I install laravel-stats?
- Install the package as a dev dependency with Composer: composer require "wnx/laravel-stats" --dev Clear the config cache before running (recommended): php artisan config:clear Generate the statistics in your Laravel project: php artisan stats
- Where can I get laravel-stats?
- The source code and installation instructions are on GitHub: https://github.com/stefanzweifel/laravel-stats
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
cloc is a command-line tool that counts blank, comment, and source lines of code across many programming languages.
A Laravel wrapper around PhpSpreadsheet for exporting collections, queries and Blade views to Excel or CSV, and importing spreadsheets into Eloquent models.
Laravel package for i18n URL localization: locale-prefixed routes, browser language detection, translatable route slugs and language selector helpers.
A PHP SDK for building Telegram bots on the Telegram Bot API, with built-in Laravel support.
A real-time chat package for Laravel that adds direct messages, groups, attachments, and a bundled messenger UI to a Laravel app.