librelist archives

« back to archive

Release of Photon 0.1, first beta release

Release of Photon 0.1, first beta release

From:
Loic d'Anterroches
Date:
2011-03-11 @ 16:35
Hello,

my poor internet connection is saturated the time to push the latest 0.1
online. You know have sessions with file and encrypted cookies backend.

The idea to encrypt the cookie values when using the cookies as session
storage is from Mickaël Desfrênes.

Session usage in practice is enabled by adding the session middleware to
your middleware classes and select your session storage:

 'middleware_classes' => array('\photon\session\Middleware'),
 'session_storage' => '\photon\session\storage\Cookies',
 'session_storage' => '\photon\session\storage\File',

Then, in your views:

    public function index($request, $match)
    {
        if (!isset($request->session['foo'])) {
            $request->session['foo'] = 1;
        } else {
            $request->session['foo'] += 1;
        }
        return new \photon\http\Response(sprintf("Hello %d times!\n",
                                         $request->session['foo']));
    }

The session system is smart enough to not create a session if you do not
use it, to not load the session data from the storage if you do not use
it, to set the correct "Vary" header if you use session data to render a
view, to not commit on disk or in the storage the data if not touched.
Basically, it tries to do the work the right way and to do it the
efficient way.

Next steps are to get authentication and permissions (ACL).

I need to update the documentation too. As usual, 100% test coverage :)

loïc

--
Indefero - Project management and code hosting - http://www.indefero.net
Photon - High Performance PHP Framework - http://photon-project.com
Céondo Ltd - Web + Science = Fun - http://www.ceondo.com