How can you set and get a cookie in Slim Framework?

devquora
devquora

Posted On: Feb 22, 2020

 

Along with the HTTP request currently made, automatically there is parsing done of the cookies. Cookies values are fetched with the getcookie() of the Slim application.

$app = new \Slim\Slim();
$foo = $app->getCookie('foo');

A subsequent request needs to be made along to see the cookie along with the current request. \Slim\Http\Request object is also used to set and get the cookies.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Slim framework interview questions

    How is Slim framework different from other frameworks like Laravel, Symfony or Zend?

    How is Slim framework different from other frameworks like Laravel, Symfony or Zend?..

    Slim framework interview questions

    Is Slim framework similar to Symfony’s Silex? How do they differ?

    Is Slim framework similar to Symfony’s Silex? How do they differ?..