smytsyk-dev / freque
The library to get stats how frequently files are changed based on GIT commits information.
0.0.1
2018-10-31 21:19 UTC
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^7.4
This package is auto-updated.
Last update: 2025-04-29 01:18:58 UTC
README
The library to get stats how frequenlty files are changed based on GIT commits information.
Requirements
- PHP 7 or above.
- GIT
Installation
Install the latest version with
$ composer require smytsyk-dev/freque
Basic Usage
./vendor/bin/freque path_to_GIT_directory
Example of the output
| # | Total | Last Modified Date | File
--------------------------------------------------------------------------------
| 1 | 5 | Sun, 28 Oct 18 18:45:00 +0000 | composer.json
| 2 | 3 | Sun, 28 Oct 18 20:36:05 +0000 | freque
| 3 | 3 | Sun, 28 Oct 18 19:52:56 +0000 | src/Runner.php
| 4 | 2 | Sun, 28 Oct 18 18:45:00 +0000 | src/JsonFormatter.php
| 5 | 2 | Sun, 28 Oct 18 18:45:00 +0000 | src/Reporter.php
| 6 | 2 | Sun, 28 Oct 18 13:48:34 +0000 | src/File.php
| 7 | 2 | Sun, 28 Oct 18 18:45:00 +0000 | src/Formatter.php
| 8 | 2 | Sat, 27 Oct 18 21:03:15 +0000 | src/Processor.php
Formatter
The default formatter is "Console"
There is a way to get the output in JSON
./vendor/bin/freque --formatter=json /Library/WebServer/Documents/file_stats/freque
Advanced Usage
You can introduce your own formatter, file scanner or any other component. The design allows adding new requirements and modifying the behavior.
use Freque\FileChangesHistoryLoader; use Freque\JsonFormatter; use Freque\Processor; use Freque\Reporter; use Freque\Runner; use Freque\Utils\GitFileHistoryLoader; use Freque\Utils\ScandirFileScanner; use Freque\Utils\ShellExec; $runner = new Runner(new Processor(new ScandirFileScanner()), new FileChangesHistoryLoader(new GitFileHistoryLoader(new ShellExec())), new Reporter(new JsonFormatter()) ); $targetGitRepositoryDir = '' echo $runner->run($targetGitRepositoryDir) . PHP_EOL;
License
This library is released under the MIT license.