In Liten, you can set regular cookies or secure cookies which are saved in a secure location on the server.


Cookie Settings

When instantiating a Liten application, you can set the cookie lifetime and/or you can set cookie lifetime via the set cookie or set secure cookie methods.

There are several settings you can set for regular and secure cookies:

Note that the default path setting for secure cookies is the /tmp/ directory. If your server gets rebooted for some reason on a regular basis, you might want to change this setting. Just make sure that it is set below the root directory and is inaccessible to the public.

Regular Cookie

In order to set a regular cookie, use the set method:

The $expires value is the number of seconds.

To retrieve a regular cookie, use the get method:

In order to unset a regular or secure cookie, use the remove method:

Secure Cookie

Secure cookies are similar to sessions in that the cookie value is a string which corresponds to a file saved on the server. Also, just like sessions, the cookie file could be deleted when the server is rebooted. However, unlike sessions, you won’t have old cookie files sitting on the server taking up space. If they have expired, they will be deleted.

A secured cookie file may look like the following:

The data in the cookie file is serialized and below is an example of the serialized data:


Last Modified: Apr 14, 2015 @ 10:03 PM

Liten Framework Forums Cookies

  • You must be logged in to reply to this topic.