bakgul / file-history
This is a helper package, and it can't be used independently. Its purpose is to log the changes of files when they are created/deleted/updated through the commands shipped with the packages, which are part of Packagified Laravel. So this package can't track the changes made manually.
Requires
- php: ^8.1
- bakgul/file-content: ^4.0
- bakgul/kernel: ^4.0
- bakgul/laravel-helpers: ^1.0
README
This is a helper package, to keep/undo/redo file history when files are created/deleted/updated via console commands of my other packages.
That being said, I don't see any reason not be able to use it outside console independantely. But I've never tried it.
Installation
sail composer require bakgul/file-history --dev
Optionally, you can publish package's config file
sail artisan vendor:publish --tag=file-history
Commands
This package contains 3 console commands. They are quite self-explanatory and don't expect any arguments or options.
sail artisan file-history:delete
sail artisan file-history:redo
sail artisan file-history:undo
Usage
First, you should use HasHistory
trait on command file and call $this->logFile();
in handle()
method. This will generate a history file to use during current command's lifecycle.
Then you should execute the following code before you create/update/delete a file/folder:
use Bakgul\FileHistory\FileHistory; FileHistory::set( path: 'path to file', isDir: true/false, isCreated: true/false );
License
This is open-sourced software licensed under the MIT license.