Download the PHP package motomedialab/runtime-store without Composer
On this page you can find all versions of the php package motomedialab/runtime-store. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download motomedialab/runtime-store
More information about motomedialab/runtime-store
Files in motomedialab/runtime-store
Package runtime-store
Short Description Store data to be shared across application for the duration of the applications runtime
License MIT
Homepage https://github.com/motomedialab/runtime-store
Informations about the package runtime-store
Runtime data store - simple runtime value caching
A simple framework-agnostic package (that plays particularly nicely with Laravel's app container, see here) that allows caching of values for the duration of a requests lifetime.
This is particularly useful in cases where scripts may be called on multiple times and depend on
third parties or query calls to return data.
Installation
You can install the package via composer:
Usage
Runtime store comes with a global helper store()
which uses the singleton pattern and we recommend using.
However, there are multiple ways of accessing the Runtime Store as its framework agnostic, see here.
The package utilises a similar API to Laravel's cache
and session
helpers, as demonstrated below.
Grouping
As of v1.2, you can create groups. Groups have the exact same API as above, with a few extras methods to easily create and delete groups.
Accessing the store
There are many ways to access the store and you can write your own implementation quickly and easily.
Accessing from within a class
We've built a handy trait which you can use in your classes to instantly boot up a grouped store, scoped to that class name. In the example below, any values will be set within a group called YourClass
automatically.
Further implementations
We've covered off pretty much everything above but if you're looking to implement the RuntimeStore in your own way, here's a couple of examples...
Testing
We've carried out extensive testing to make sure everything works as expected, but feel free to try it yourself!
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate, a super handy
package templating application.