Package Data | |
---|---|
Maintainer Username: | fetzi |
Maintainer Contact: | alexander.lentner@karriere.at (Alexander Lentner) |
Package Create Date: | 2016-11-24 |
Package Last Update: | 2024-02-27 |
Home Page: | https://packagist.org/packages/karriere/state |
Language: | PHP |
License: | Apache-2.0 |
Last Refreshed: | 2024-12-22 03:13:37 |
Package Statistics | |
---|---|
Total Downloads: | 14,725 |
Monthly Downloads: | 191 |
Daily Downloads: | 4 |
Total Stars: | 17 |
Total Watchers: | 4 |
Total Forks: | 1 |
Total Open Issues: | 0 |
This laravel package allows to store a certain application state in either the session or inside a cache.
Run composer require karriere/state
to install this package.
To enable the package you need to reference the StoreServiceProvider
class inside your config/app.php
file in the providers
section:
'providers' => [
...
Karriere\State\StateServiceProvider::class,
...
];
To store the application state you create a state object and store it:
$state = $stateFactory->build('state-name', ['key' => 'value']);
$store->put($state);
// pass on $state->identifier()
In a later situation where you have the state identifier you can access the states data by:
$state = $store->get($identifier);
if(!$state->isEmpty()) {
// use either $state->collection() or $state->raw() to access the state data
}
To install the configuration file you simply use:
php artisan vendor:publish
storage
: session|cachestorage-prefix
: prefix that is added to the store identifierexpires-after
: defines the expires after time in seconds, only used for CacheStore
Apache License 2.0 Please see LICENSE for more information.