bpartner/storage

Storage for global variables

1.0.0 2019-01-07 15:23 UTC

This package is auto-updated.

Last update: 2024-10-21 21:22:23 UTC


README

Total Downloads Latest Stable Version PHP version

Storage for global variable.

Save global variables as an array and access this array from anywhere in the program.

An interface is provided for implementing storage on disk or in a database, such as a sqlite.

Install with composer

$ composer require bpartner/storage

Usage

Save variable

<?php
use Bpartner\Storage\StorageInMemory;

$key = 'user';
$value = [
    'first_name' => 'John',
    'last_name'  => 'Doe',
    'email'      => 'jdoe@mail.com'
];
StorageInMemory::setParam($key, $value);

Get variable

<?php
use Bpartner\Storage\StorageInMemory;

$user = StorageInMemory::getParam('user');

echo $user['first_name'];