1. Go to this page and download the library: Download popphp/pop-web 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/ */
popphp / pop-web example snippets
use Pop\Web\Session;
$sess = Session::getInstance();
// Set session values
$sess->foo = 'bar';
$sess['baz'] = 123;
// Access session values
echo $sess['foo'];
echo $sess->baz;
// Unset session values
unset($sess->foo);
unset($sess['baz']);
// Kill/clear out the session
$sess->kill();
use Pop\Web\Session;
$sess = Session::getInstance();
$sess->setTimedValue('foo', 'bar', 10); // # of seconds
if (isset($sess->foo)) {
echo $sess->foo;
} else {
echo 'Nope!';
}
use Pop\Web\Session;
$sess = Session::getInstance();
$sess->setRequestValue('foo', 'bar', 1); // # of requests
if (isset($sess->foo)) {
echo $sess->foo;
} else {
echo 'Nope!';
}
use Pop\Web\SessionNamespace;
$sess = new SessionNamespace(__NAMESPACE__);
$sess->foo = 'bar'
if (isset($sess->foo)) {
echo $sess->foo; // Only available under the namespace passed.
} else {
echo 'Nope!';
}