Cookies Management

Cookies Management

Cookies are very useful way to store small pieces of data in the client that can be retrieved even if the user closes his/her browser. Phalcon\Http\Response\Cookies acts as a global bag for cookies. Cookies are stored in this bag during the request execution and are sent automatically at the end of the request.

Basic Usage

You can set/get cookies by just accessing the ‘cookies’ service in any part of the application where services can be accessed:

class SessionController extends Phalcon\Mvc\Controller
{
    public function loginAction()
    {
        //Check if the cookie has previously set
        if ($this->cookies-&g