News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Master Zend Framework:
Using Sessions In Zend Framework 2 - Part 1
April 29, 2014 @ 12:09:49

On his Master Zend Framework site today Matthew Setter has posted the first part of a series looking at working with sessions in Zend Framework 2 applications.

To help work around [the stateless nature of the language], PHP introduced the concept of sessions, which allows for storing information across requests. However, like most things, as application's have become more complex, the ability to interact with sessions in a way that matches the needs of the application has continued to grow. Gladly, in Zend Framework 2, a set of classes is available, which helps reduce the complexity of managing session information, whether that's interaction, configuration or backend storage, without placing too much distance between you and the underlying PHP implementation, or adding too much complexity in the process.

Using the ZF2Skeleton as a base, he shows you how to add session support to the overall project in a few simple steps:

  • Update Module.php to initialize the session
  • Create a new container & store some data
  • Retrieve it later

There's not too much code change involved, but the snippets to add/update are included. In the next part of the series, he'll look at validation, preventing hijacking and using different backend storage methods.

0 comments voice your opinion now!
zendframework2 session tutorial series part1 introduction

Link: http://www.masterzendframework.com/sessions/using-sessions-in-zend-framework-2-part-1

blog comments powered by Disqus

Similar Posts

Zend Developer Zone: Manipulating Configuration Data with Zend_Config

PHP-Coding-Practices.com: How To Generate Monochromatic CSS Stylesheets Within Seconds Using PHP

SitePoint PHP Blog: Coding a Lorem Ipsum Alternative

PHPMaster.com: Build a CRUD App with Yii in Minutes

NETTUTS.com: How to Build a Super Duper News Scroller


Community Events





Don't see your event here?
Let us know!


podcast series community package release language introduction tips symfony opinion interview api update install laravel framework zendserver bugfix deployment library

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework