How to Create,Get,Check Sessions in Zend Framework 2?

In GF2 in order to use Sessions we should use this use ZendSessionContainer; class. This class Container extends of ArrayObject and instantiates with ARRAY_AS_PROPS flag that means you can easily iterate through properties and read/write them.

After Placing above line of code in place , you need to instantiate the ZendSessionContainer class and pass a name to the constructor (name is optional).

How to set value in session

How to Read or Get Session Value By Key

How to Check for key exists in session

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.