Skip to content

Instantly share code, notes, and snippets.

@kelunik
Created August 27, 2015 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelunik/5daeec1aafed88002957 to your computer and use it in GitHub Desktop.
Save kelunik/5daeec1aafed88002957 to your computer and use it in GitHub Desktop.
<?php
function handleSessionWriteRequest(Request $request, Response $response) {
$session = yield (new Session($request))->open();
$something = $session->get("something");
$session->set("something", "{$something}-else");
yield $session->save();
$response->send("Content: $something");
}
function handleSessionReadOnlyRequest(Request $request, Response $response) {
$session = (new Session($request))->read();
$something = $session->get("...");
$response->send("Content: $something");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment