legalworks / laravel-logged-values
Ever needed to store simple values easily, that could change over time or even in the future? When Event Sourcing is just a bit too much?
Package info
github.com/legalworks/laravel-logged-values
pkg:composer/legalworks/laravel-logged-values
Requires
- illuminate/support: ~7|~8
Requires (Dev)
- orchestra/testbench: ~5|~6
- phpunit/phpunit: ~9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Ever needed to store simple values easily, that could change over time or even in the future? When Event Sourcing is just a bit too much? This is for you... maybe.
Installation
Via Composer
$ composer require legalworks/laravel-logged-values
Usage
Add trait
use Legalworks\LoggedValues\HasLoggedValues; class SomeModel extends Model{ use HasLoggedValues; ... }
Add any logged values
$someModel->logValue('pages', 500, [
'effective_at' => now(), //optional, defaults to now()
'description' => null, //optional
]);
Get logged values
$someModel->loggedValues; //all logged values $someModel->groupedValues; //all values grouped by key $someModel->pastValues; $someModel->futureValues; $someModel->getLatestValue('pages', '2020-10-27 12:00:00'); //get the latest value of the given key before given (optional) datetime
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
license. Please see the license file for more information.