1. Go to this page and download the library: Download naucon/storage library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
naucon / storage example snippets
class Product implements \Serializable
{
protected $id;
protected $sku;
protected $description;
public function getId()
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
}
public function getSku()
{
return $this->sku;
}
public function setSku($sku)
{
$this->sku = $sku;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description)
{
$this->description = $description;
}
}
use Naucon\Storage\Provider\ArrayStorage;
use Naucon\Storage\StorageManager;
$adapter = new ArrayStorage(Product::class);
$manager = new StorageManager($adapter);
$model = new Product();
$model->setId(1);
$model->setSku('U123');
$model->setDescription('Dragon fruit');
$manager->flush(1, $model);