Skip to content

Instantly share code, notes, and snippets.

@Majkl578
Created February 28, 2012 12:18
Show Gist options
  • Save Majkl578/1932200 to your computer and use it in GitHub Desktop.
Save Majkl578/1932200 to your computer and use it in GitHub Desktop.
Standalone Nette\Http\Session
<?php
use Nette\Http;
require $libsDir . '/Nette/loader.php';
// init
$requestFactory = new Http\RequestFactory();
$session = new Http\Session($requestFactory->createHttpRequest(), new Http\Response());
// start
$session->start();
// usage
$section = $session->getSection('foo');
$section->bar = isset($section->bar) ? $section->bar + 1 : 1;
echo $section->bar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment