2017 © Pedro Peláez
 

library php-data-storage

Simple PHP Data Storage

image

frostealth/php-data-storage

Simple PHP Data Storage

  • Friday, November 13, 2015
  • by frostealth
  • Repository
  • 1 Watchers
  • 0 Stars
  • 728 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

PHP Data Storage

Simple PHP Data Storage., (*1)

Installation

Run the Composer command to install the latest stable version:, (*2)

composer require frostealth/php-data-storage @stable

Usage

$storage = new frostealth\storage\Data(); // or new frostealth\storage\Data($array);
$storage->set('login', 'example@example.com');

// ...

if ($storage->has('login')) {
    $login = $storage->get('login');
    $storage->remove('login');
}
// or with default value
if ($storage->get('login', false)) {
    $login = $storage->get('login');
    $storage->remove('login');
}

// ...

$storage->clear(); // clear all values

Working with arrays using "dot" notation, (*3)

$storage = new frostealth\storage\ArrayData();
$storage->set('params', ['method' => 'post', 'url' => 'http://example.com/']);

$url = $storage->get('params.url'); // 'http://example.com/'
$storage->set('params.method', 'get');
$method = $storage->get('params.method'); // 'get'
$params = $storage->get('params'); // ['method' => 'get', 'url' => 'http://example.com/']

$storage->set('options.my_option', 'value');
$options = $storage->get('options'); // ['my_option' => 'value']

Dependency Injection

use frostealth\storage\DataInterface;

class MyClass
{
    /**
     * @var DataInterface
     */
    protected $data;

    /**
     * @param DataInterface $data
     */
    public function __construct(DataInterface $data)
    {
        $this->data = $data;
    }
}

License

The MIT License (MIT). See LICENSE.md for more information., (*4)

The Versions

13/11 2015

dev-master

9999999-dev

Simple PHP Data Storage

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

data storage

11/11 2015

2.1.0

2.1.0.0

Simple PHP Data Storage

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

data storage

09/11 2015

2.0.0

2.0.0.0

Simple PHP Data Storage

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

data storage

11/04 2015

1.0.2

1.0.2.0

PHP Data Storage

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

storage

01/10 2014

1.0.1

1.0.1.0

PHP Data Storage

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Kudinov Ivan

storage

29/08 2014

1.0.0

1.0.0.0

PHP Data Storage

  Sources   Download

The Requires

  • php >=5.4.0

 

by Kudinov Ivan