PHP Classes

PHP GIT Insights Analyzer: Present report of PHP projects in a Git repository

Recommend this page to a friend!
  Info   View files Documentation   View files View files (46)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-02-27 (18 days ago) RSS 2.0 feedNot enough user ratingsTotal: 18 This week: 1All time: 11,184 This week: 105Up
Version License PHP version Categories
php-git-insights-ana 1.0The PHP License7Project Management, PHP 7
Description 

Author

This package can present reports of PHP projects in a Git repository.

It uses the git command from the command line console to analyze the files and the changes made to those files to elaborate a report.

Currently, the report is outputted to the command line console and can show a list of files with the following:

- The number of lines

- Number of commits

- Number of contributors

- Average Commit Size

- Average Commit Size Ratio

- Workload Per Contributor

- Workload Per Contributor Ratio

Innovation Award
PHP Programming Innovation award nominee
February 2024
Nominee
Vote
Git is a top-rated version control program many experienced developers use to track the changes in their project files.

This package can generate reports about files in projects that use Git to keep track of file changes.

This way, developers can have an overview of the evolution of their project files.

Manuel Lemos
Picture of DeGraciaMathieu
  Performance   Level  
Name: DeGraciaMathieu <contact>
Classes: 16 packages by
Country: France France
Innovation award
Innovation award
Nominee: 11x

Winner: 1x

Documentation

<p align="center"> <img src="https://github.com/DeGraciaMathieu/php-smelly-code-detector/blob/master/arts/robot.png" width="250"> </p>

php-git-insights-analyzer

Phar

This tool is distributed as a PHP Archive (PHAR):

wget https://github.com/DeGraciaMathieu/php-git-insights-analyzer/raw/master/builds/php-git-insights-analyzer

php php-git-insights-analyzer --version

Usage

First, you need to load the data required for the analysis :

php php-git-insights-analyzer app:load

Package uses git commands to retrieve files history, which is relatively time-consuming, so it was more efficient to create a database before carrying out the analyses.

> For information, database is stored in the analyse.json

Then analyse the data using the following command :

php php-git-insights-analyzer app:report

$ php php-git-insights-analyzer app:report

 ? PHP Git Insights Analyzer ?

 ?????????????????????????????????????????????????????????????????????????????????????????????????
 ? name                                        ? lines ? comm. ? cont. ? acs ? acsr ? wpc ? wpcr ?
 ?????????????????????????????????????????????????????????????????????????????????????????????????
 ? Actions/GameAndRandomClipsSample.php        ? 55    ? 2     ? 1     ? 27  ? 49   ? 55  ? 100  ?
 ? Console/Kernel.php                          ? 27    ? 1     ? 1     ? 27  ? 100  ? 27  ? 100  ?
 ? Dtos/Uuid.php                               ? 37    ? 3     ? 1     ? 12  ? 32   ? 37  ? 100  ?
 ? Enums/AutoplayEnum.php                      ? 9     ? 1     ? 1     ? 9   ? 100  ? 9   ? 100  ?
 ? Enums/ClipStateEnum.php                     ? 15    ? 2     ? 1     ? 7   ? 46   ? 15  ? 100  ?
 ? Exceptions/AssertException.php              ? 10    ? 1     ? 1     ? 10  ? 100  ? 10  ? 100  ?
 ? Exceptions/Handler.php                      ? 35    ? 4     ? 1     ? 8   ? 22   ? 35  ? 100  ?
 ? Http/Controllers/Controller.php             ? 12    ? 1     ? 1     ? 12  ? 100  ? 12  ? 100  ?
 ? Http/Controllers/HomeController.php         ? 37    ? 9     ? 2     ? 4   ? 10   ? 18  ? 48   ?
 ? Http/Controllers/PaginateClipController.php ? 48    ? 8     ? 2     ? 6   ? 12   ? 24  ? 50   ?
 ?????????????????????????????????????????????????????????????????????????????????????????????????

Understanding analysis :

| Abbreviation | Metric | Description | | ------------ | ------------------------------ | ------------------------------------------------------------------------------ | | comm. | Commits | Number of file commits. | | cont. | Contributors | Number of distinct contributors. | | acs | Average Commit Size | Average size of file commits. | | acsr | Average Commit Size Ratio | Proportion of average commit size compared to the total file size. | | wpc | Workload Per Contributor | Average size of a contributor's commits. | | wpcr | Workload Per Contributor Ratio | Proportion of average contributor commit size compared to the total file size. |

Options

| Options | Description | |-----------------------|-------------| | --folder= | Filter results by folder (e.g., --folder=Http/Controllers).| | --limit= | Specify the maximum number of results to display (default is 10).| | --sorts= | Sets the sorting order for results. The first value (lines, commits, contributors, acs, acsr, wpc, wpcr) corresponds to the affected field, and the second value (desc,asc; default desc) determines the sorting order.| | --thresholds= | Sets a threshold for the specified metric to filter results. The first value (lines, commits, contributors, acs, acsr, wpc, wpcr) corresponds to the affected metric, and the second value (e.g., 60) represents the minimum value required to apply the threshold.|

Examples

Files with more than 300 lines and low contributor diversity :

php php-git-insights-analyzer app:report --limit=10 --thresholds=wpcr,60 --thresholds=lines,300

Files with more than 10 commits and low contributor diversity :

php php-git-insights-analyzer app:report --limit=10 --thresholds=wpcr,60 --thresholds=commits,10

File with more than 10 commits and a renewal ratio of 10% with each commit.

php php-git-insights-analyzer app:report --limit=10 --thresholds=acsr,10 --thresholds=commits,10

> [!TIP] > Other analysis tools are available.


  Files folder image Files  
File Role Description
Files folder imageapp (5 directories)
Files folder imagebootstrap (1 file)
Files folder imageconfig (3 files)
Files folder imagetests (3 files, 2 directories)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file box.json Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Plain text file php-git-insights-analyzer Class Class source
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  app  
File Role Description
Files folder imageApplication (2 directories)
Files folder imageDomain (4 directories)
Files folder imageInfrastructure (2 directories)
Files folder imagePresenter (1 directory)
Files folder imageProviders (1 file)

  Files folder image Files  /  app  /  Application  
File Role Description
Files folder imageLoad (3 files)
Files folder imageReport (3 files)

  Files folder image Files  /  app  /  Application  /  Load  
File Role Description
  Plain text file LoadHandler.php Class Class source
  Plain text file LoadOutputInterface.php Class Class source
  Plain text file LoadRequestInterface.php Class Class source

  Files folder image Files  /  app  /  Application  /  Report  
File Role Description
  Plain text file ReportHandler.php Class Class source
  Plain text file ReportOutputInterface.php Class Class source
  Plain text file ReportRequestInterface.php Class Class source

  Files folder image Files  /  app  /  Domain  
File Role Description
Files folder imageAggregators (2 files)
Files folder imageContracts (2 directories)
Files folder imageEntities (5 files)
Files folder imageServices (3 files)

  Files folder image Files  /  app  /  Domain  /  Aggregators  
File Role Description
  Plain text file ReportAggregator.php Class Class source
  Plain text file TrackedFileAggregator.php Class Class source

  Files folder image Files  /  app  /  Domain  /  Contracts  
File Role Description
Files folder imageGateways (1 file)
Files folder imageRepositories (1 file)

  Files folder image Files  /  app  /  Domain  /  Contracts  /  Gateways  
File Role Description
  Plain text file FileVersionControlGateway.php Class Class source

  Files folder image Files  /  app  /  Domain  /  Contracts  /  Repositories  
File Role Description
  Plain text file TrackedFileRepository.php Class Class source

  Files folder image Files  /  app  /  Domain  /  Entities  
File Role Description
  Plain text file Analysis.php Class Class source
  Plain text file Metric.php Class Class source
  Plain text file Path.php Class Class source
  Plain text file ReportLine.php Class Class source
  Plain text file TrackedFile.php Class Class source

  Files folder image Files  /  app  /  Domain  /  Services  
File Role Description
  Plain text file ReportGenerator.php Class Class source
  Plain text file TrackedFileAnalyzer.php Class Class source
  Plain text file TrackedFileService.php Class Class source

  Files folder image Files  /  app  /  Infrastructure  
File Role Description
Files folder imageGateways (1 file)
Files folder imageRepositories (1 file)

  Files folder image Files  /  app  /  Infrastructure  /  Gateways  
File Role Description
  Plain text file CliGitGateway.php Class Class source

  Files folder image Files  /  app  /  Infrastructure  /  Repositories  
File Role Description
  Plain text file TrackedFileStorageRepository.php Class Class source

  Files folder image Files  /  app  /  Presenter  
File Role Description
Files folder imageCommands (2 directories)

  Files folder image Files  /  app  /  Presenter  /  Commands  
File Role Description
Files folder imageLoad (3 files)
Files folder imageReport (1 file, 1 directory)

  Files folder image Files  /  app  /  Presenter  /  Commands  /  Load  
File Role Description
  Plain text file LoadCliOutput.php Class Class source
  Plain text file LoadCliRequest.php Class Class source
  Plain text file LoadCommand.php Class Class source

  Files folder image Files  /  app  /  Presenter  /  Commands  /  Report  
File Role Description
Files folder imageCli (3 files, 1 directory)
  Plain text file ReportCommand.php Class Class source

  Files folder image Files  /  app  /  Presenter  /  Commands  /  Report  /  Cli  
File Role Description
Files folder imageConcerns (2 files)
  Plain text file ReportCliOutput.php Class Class source
  Plain text file ReportClipOutputOptions.php Class Class source
  Plain text file ReportCliRequest.php Class Class source

  Files folder image Files  /  app  /  Presenter  /  Commands  /  Report  /  Cli  /  Concerns  
File Role Description
  Plain text file Sorts.php Class Class source
  Plain text file Thresholds.php Class Class source

  Files folder image Files  /  app  /  Providers  
File Role Description
  Plain text file AppServiceProvider.php Class Class source

  Files folder image Files  /  bootstrap  
File Role Description
  Plain text file app.php Class Class source

  Files folder image Files  /  config  
File Role Description
  Plain text file app.php Class Class source
  Plain text file commands.php Class Class source
  Accessible without login Plain text file filesystems.php Aux. Auxiliary script

  Files folder image Files  /  tests  
File Role Description
Files folder imageFeature (1 file)
Files folder imageUnit (1 file)
  Plain text file CreatesApplication.php Class Class source
  Plain text file Pest.php Class Class source
  Plain text file TestCase.php Class Class source

  Files folder image Files  /  tests  /  Feature  
File Role Description
  Accessible without login Plain text file InspireCommandTest.php Example Example script

  Files folder image Files  /  tests  /  Unit  
File Role Description
  Accessible without login Plain text file ExampleTest.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:18
This week:1
All time:11,184
This week:105Up