https://github.com/stefanzweifel/laravel-stats

📈 Get insights about your Laravel or Lumen Project

https://github.com/stefanzweifel/laravel-stats

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • ✓
    .zenodo.json file
    Found .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • â—‹
    Committers with academic emails
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (11.9%) to scientific vocabulary

Keywords

composer laravel laravel-package php statistics
Last synced: 6 months ago · JSON representation

Repository

📈 Get insights about your Laravel or Lumen Project

Basic Info
  • Host: GitHub
  • Owner: stefanzweifel
  • License: mit
  • Language: PHP
  • Default Branch: main
  • Homepage:
  • Size: 1.74 MB
Statistics
  • Stars: 1,743
  • Watchers: 24
  • Forks: 85
  • Open Issues: 0
  • Releases: 46
Topics
composer laravel laravel-package php statistics
Created over 8 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct

README.md

Laravel Stats

Buy us a tree

Get insights about your Laravel or Lumen Project.

Screenshot

Installing

The easiest way to install the package is by using composer.

shell composer require "wnx/laravel-stats" --dev

The package will automatically register itself.

If you're using Lumen you have to manually register the Service Provider in your bootstrap/app.php file:

php $app->register(\Wnx\LaravelStats\StatsServiceProvider::class);

Optionally, you can publish the config file in your Laravel applications with the following command:

shell php artisan vendor:publish --provider="Wnx\LaravelStats\StatsServiceProvider"

Usage

After installing you can generate the statistics by running the following Artisan Command.

shell php artisan stats (Make sure you run php artisan config:clear before running the above command.)

The statistics are also available as JSON.

shell php artisan stats --json

If you want a more detailed report and see which classes have been grouped into which component, you can use the --verbose-option.

php artisan stats --verbose

The verbose option is available for the JSON format also.

php artisan stats --json --verbose

Note If your project is using Pest PHP for writing tests, these files will automatically be excluded from the statistics. Due to how "laravel-stats" works internally, Pest PHP tests can't currently be detected. See #194 for more information.

How does this package detect certain Laravel Components?

The package scans the files defined in the paths-array in the configuration file. It then applies Classifiers to those classes to determine which Laravel Component the class represents.

| Component | Classification | |:--|:--| | Livewire Components | Must extend Livewire\Component | | Controller | Must be registered with a Route & does not extend Livewire\Component | | Model | Must extend Illuminate\Database\Eloquent\Model | | Command | Must extend Illuminate\Console\Command | | Rule | Must extend Illuminate\Contracts\Validation\Rule | | Policy | The Policy must be registered in your AuthServiceProvider | | Middleware | The Middleware must be registered in your Http-Kernel | | Event | Must use Illuminate\Foundation\Events\Dispatchable-Trait | | Event Listener | Must be registered for an Event in EventServiceProvider | | Mail | Must extend Illuminate\Mail\Mailable | | Notification | Must extend Illuminate\Notifications\Notification | | Nova Action | Must extend Laravel\Nova\Actions\Action | | Nova Dashboard | Must extend Laravel\Nova\Dashboard | | Nova Filter | Must extend Laravel\Nova\Filters\Filter | | Nova Lens | Must extend Laravel\Nova\Lenses\Lens | | Nova Resource | Must extend Laravel\Nova\Resource | | Job | Must use Illuminate\Foundation\Bus\Dispatchable-Trait | | Migration | Must extend Illuminate\Database\Migrations\Migration | | Request | Must extend Illuminate\Foundation\Http\FormRequest | | Resource | Must extend Illuminate\Http\Resources\Json\JsonResource or Illuminate\Http\Resources\Json\ResourceCollection | | Seeder | Must extend Illuminate\Database\Seeder | | ServiceProvider | Must extend Illuminate\Support\ServiceProvider | | Blade Components | Must extend Illuminate\View\Component | | Custom Casts | Must implement Illuminate\Contracts\Database\Eloquent\CastsAttributes or Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes | | Database Factory | Must extend Illuminate\Database\Eloquent\Factory | | Dusk Tests | Must extend Laravel\Dusk\TestCase | | BrowserKit Test | Must extend Laravel\BrowserKitTesting\TestCase | | PHPUnit Test | Must extend PHPUnit\Framework\TestCase |

Create your own Classifiers

If your application has it's own components you would like to see in laravel-stats you can create your own "Classifiers". Create your own Classifiers by implementing the Classifier-contract and adding the class to the stats.custom_component_classifier config array.

For example:

```php // app/Classifiers/RepositoryClassifier.php <?php

namespace App\Classifiers;

use Wnx\LaravelStats\ReflectionClass; use Wnx\LaravelStats\Contracts\Classifier;

class RepositoryClassifier implements Classifier { public function name(): string { return 'Repositories'; }

public function satisfies(ReflectionClass $class): bool
{
    return $class->isSubclassOf(\App\Repositories\BaseRepository::class);
}

public function countsTowardsApplicationCode(): bool
{
    return true;
}

public function countsTowardsTests(): bool
{
    return false;
}

} ```

php // config/stats.php <?php ... 'custom_component_classifier' => [ \App\Classifiers\RepositoryClassifier::class ], ...

Treeware

You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.

Its now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest youll be creating employment for local families and restoring wildlife habitats.

You can buy trees here offset.earth/treeware

Read more about Treeware at treeware.earth

Running the tests

The package has tests written in phpunit. You can run them with the following command.

shell ./vendor/bin/phpunit

Running the command in a local test project

If you're working on the package locally and want to just run the command in a demo project you can use the composer path-repository format. Add the following snippet to the composer.json in your demo project.

json { "repositories": [ { "type": "path", "url": "/path/to/laravel-stats/", "options": { "symlink": true } } ], }

And "install" the package with composer require wnx/laravel-stats. The package should now be symlinked in your demo project.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Credits

License

This project is licensed under the MIT License - see the LICENSE file for details.

Owner

  • Name: Stefan Zweifel
  • Login: stefanzweifel
  • Kind: user
  • Location: Zurich
  • Company: @2media

Full Stack Developer working with Laravel, Vue.js, Tailwind CSS and alpine.js.

GitHub Events

Total
  • Release event: 2
  • Watch event: 19
  • Delete event: 2
  • Push event: 11
  • Pull request event: 4
  • Create event: 5
Last Year
  • Release event: 2
  • Watch event: 19
  • Delete event: 2
  • Push event: 11
  • Pull request event: 4
  • Create event: 5

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 769
  • Total Committers: 27
  • Avg Commits per committer: 28.481
  • Development Distribution Score (DDS): 0.147
Past Year
  • Commits: 8
  • Committers: 1
  • Avg Commits per committer: 8.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Stefan Zweifel h****o@s****o 656
Jergus Lejko j****o@g****m 53
Jason McCreary j****n@p****t 7
AdrianHL 1****L 6
Ryan Bilesky r****n@x****m 6
Stan Goldmann g****n@t****e 6
Jordan Pittman j****n@c****e 5
aiiro a****o 4
João Roberto P. Borges j****b@g****m 3
Stefan Rempe s****5@g****m 2
Alexander Lichter m****L@g****t 2
Brandon Surowiec B****c 2
Dinh Quoc Han d****6@g****m 2
Dylan DPC d****c@g****m 2
Chad Sanda c****a@h****m 1
Clayton Stone d****s@o****m 1
Dariusz Rumiński d****i@g****m 1
Gabriel Caruso c****4@g****m 1
James Mills j****s@j****k 1
Mahdi Majidzadeh M****h 1
Michaël Lecerf m****f 1
Robert Gasch r****h@g****m 1
Sébastien Nikolaou i****o@s****u 1
Trevor Fitzgerald f****v 1
Verron Knowles V****s@g****m 1
Cristian Giordano c****n@s****k 1
hapidjus o****n@c****e 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 27
  • Total pull requests: 87
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 8 days
  • Total issue authors: 20
  • Total pull request authors: 15
  • Average comments per issue: 3.3
  • Average comments per pull request: 0.87
  • Merged pull requests: 82
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 11 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • stefanzweifel (7)
  • devfaysal (1)
  • moetanahy (1)
  • rjsworking (1)
  • jameswong3388 (1)
  • igorbabko (1)
  • RicardoRamirezR (1)
  • sylouuu (1)
  • Omranic (1)
  • kocoten1992 (1)
  • lasmanis (1)
  • burhanmt (1)
  • oriceon (1)
  • domthomas-dev (1)
  • dungnh (1)
Pull Request Authors
  • stefanzweifel (79)
  • AdrianHL (2)
  • rgasch (2)
  • csanda87 (1)
  • carusogabriel (1)
  • listefano (1)
  • CristianGiordano (1)
  • keradus (1)
  • fitztrev (1)
  • krenor (1)
  • x7ryan (1)
  • manniL (1)
  • jamesmills (1)
  • hapidjus (1)
  • Verron (1)
Top Labels
Issue Labels
bug (10) good first issue (5) feature request (5) open for contribution (3) help wanted (1) on hold (1) unable to reproduce (1) question (1)
Pull Request Labels
changelog:changed (14) changelog:added (9) changelog:fixed (8) changelog:deprecated (1) changelog:removed (1) bug (1) on hold (1) enhancement (1) planned feature (1)

Dependencies

composer.json packagist
  • friendsofphp/php-cs-fixer ^3.2 development
  • laravel/browser-kit-testing ^6.0|^7.0 development
  • laravel/dusk ^5.0|^6.0 development
  • livewire/livewire ^2.0 development
  • mockery/mockery ^1.1 development
  • orchestra/testbench ^5.0 || ^6.0 || ^7.0 development
  • phpunit/phpunit 8.*|9.* development
  • rector/rector ^0.11.58 development
  • vimeo/psalm ^4.0 development
  • ext-json *
  • illuminate/console ^7.0|^8.0|^9.0
  • illuminate/support ^7.0|^8.0|^9.0
  • php ^7.3 || ^8.0
  • phploc/phploc ^7.0
  • symfony/finder ^4.3|^5.0|^6.0
  • symfony/process ^4.3|^5.0|^6.0
.github/workflows/format_php.yml actions
  • actions/checkout v3 composite
  • docker://oskarstark/php-cs-fixer-ga * composite
  • stefanzweifel/git-auto-commit-action v4.1.0 composite
.github/workflows/release-drafter.yml actions
  • release-drafter/release-drafter v5 composite
.github/workflows/tests.yml actions
  • actions/cache v1 composite
  • actions/checkout v1 composite
  • codecov/codecov-action v1 composite
  • shivammathur/setup-php v2 composite
.github/workflows/update-changelog.yaml actions
  • actions/checkout v3 composite
  • stefanzweifel/changelog-updater-action v1 composite
  • stefanzweifel/git-auto-commit-action v4 composite