bpartner / storage by bpartner

Storage for global variables
40
0
2
Package Data
Maintainer Username: bpartner
Maintainer Contact: azinchenko@bpartner.com.ua (Alexander Zinchenko)
Package Create Date: 2019-01-07
Package Last Update: 2019-06-21
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:18:04
Package Statistics
Total Downloads: 40
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Storage

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'];