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?
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/legalworks/laravel-logged-values
Requires
- illuminate/support: ~7|~8
Requires (Dev)
- orchestra/testbench: ~5|~6
- phpunit/phpunit: ~9.0
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.