Demo application showing how to use Cadre.DomainSession with Radar
PHP HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
public
sessions
src/Application
views
.gitattributes
.gitignore
LICENSE.md
README.md
composer.json
composer.lock

README.md

Radar Domain Session Demo

This is a demo showing how to use Cadre.DomainSession with Radar.

Setup

git clone https://github.com/futureproofphp/radar-domain-session.git
cd radar-domain-session

# Install dependencies
composer install

Example

This demo is very simple and mirrors the functionality of the non-radar demo included in Cadre.DomainSession.

To simplify getting and setting cookies in PSR-7 I'm using the excellent dflydev-fig-cookies library.

In the Input we fetch the session id cookie value. It is null if none exists.

It loads the session (creates a new one if none exists) and checks to see if there is a timestamp value present. If none it returns "Unknown" and assigns the current timestamp to the session.

The session is finished and persisted.

In the Responder we check to see if there was a session returned from the domain. If so, we check to see if the session id was updated (new or regenerated session id). If it was we assign the session id to the session cookie.