1. Go to this page and download the library: Download mindplay/session 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/ */
mindplay / session example snippets
class Cart
{
/** @var int */
public $user_id;
/** @var int[] */
public $product_ids = array();
}
// commit session container contents to session variables:
$session->commit();
register_shutdown_function(function () use ($session) {
$session->commit();
});
use mindplay\session\SessionContainer;
$session = new SessionContainer();
// add some products to the Cart:
$session->update(
function (Cart $cart) {
$cart->product_ids[] = 777;
$cart->product_ids[] = 555;
}
);
use mindplay\session\MockSessionStorage;
use mindplay\session\SessionContainer;
$storage = new MockSessionStorage('foo');
$container = new SessionContainer($storage);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.