Sessions

Session component allows you to preserve certain data across subsequent accesses.

The easiest way to use the Session component is to access to it through the container $container->get('session').

Otherwise just add the following parameter to the construct method of your Controller Tomahawk\Session\SessionInterface and it will get injected in through the Service Container.

Putting data into the session

You can add data to the session by doing the following:

Getting data out of the session

You can add data to the session by doing the following:

Checking if data is in the session

You can check if data is in the session by doing the following:

Removing a value from the session

You can remove data from the session by doing the following:

Flash Messages

You can add flash messages to the session that are removed on next access.

Adding a flash message

You can add data to the session by doing the following:

Getting flash messages

You get flash messages by doing the following, an array is always returned:

Checking if any flash messages exist

You can check if flash messages exist by doing the following: