A free and open-source book on ZF3 for beginners

15. Working with Sessions

In this chapter, you will learn about sessions. The HTTP protocol is stateless, so you can't share data between two HTTP requests by default. PHP sessions allow to workaround this by saving data on server during one page request and retrieve it later during another page request. For example, you can remember that the user has logged in, and show a personalized web page the next time he visits the website. Zend Framework internally uses the PHP sessions, but additionally provides a convenient wrapper around PHP sessions, so you don't access $_SESSION super-global array directly.

ZF3 components covered in this chapter:

Component Description
Zend\Session Implements a wrapper around PHP sessions.