{
    "href": "/post/2017/05/02/toward-a-better-separation-of-session-behaviors-in-php/",
    "relId": "2017/05/02/toward-a-better-separation-of-session-behaviors-in-php",
    "title": "Toward A Better Separation of Session Behaviors in PHP",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/adr/",
            "relId": "adr",
            "title": "Action Domain Responder",
            "author": null,
            "created": "2020-08-17 21:07:42 UTC",
            "updated": [
                "2020-08-17 21:07:42 UTC",
                "2020-09-22 15:41:16 UTC",
                "2020-10-14 18:20:29 UTC",
                "2020-10-14 18:36:31 UTC",
                "2020-10-14 18:36:53 UTC",
                "2020-10-14 18:37:08 UTC",
                "2020-10-14 18:37:48 UTC",
                "2020-10-14 18:39:26 UTC",
                "2020-10-14 19:03:17 UTC",
                "2020-10-14 19:03:35 UTC",
                "2020-10-26 18:12:53 UTC"
            ],
            "markup": "markdown"
        },
        {
            "href": "/tag/php/",
            "relId": "php",
            "title": "PHP",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/programming/",
            "relId": "programming",
            "title": "Programming",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2017-05-02 15:09:29 UTC",
    "updated": [
        "2017-05-02 15:09:29 UTC"
    ],
    "html": "<p>Andrew Shell asks, <a href=\"https://www.futureproofphp.com/2017/05/02/best-way-handle-sessions-adr/\">What is the best way to handle sessions with ADR?</a> (The problem is that the built-in PHP session extension combines the concerns of reading input, managing storage, and sending output; the solution is a domain-layer session-data manager.)</p>\n<blockquote>\n<p>I\u00e2\u0080\u0099ve reached a point with a couple of my Radar projects where I need to add a login and set permissions. I\u00e2\u0080\u0099m trying to figure out the best way to handle this, especially with PSR-7 and ADR.  ...</p>\n<p>[In Action-Domain-Responder] it\u00e2\u0080\u0099s ok to read the session cookie in an Input class, and it\u00e2\u0080\u0099s ok to write the cookie in a Responder class, but pretty much everything else should be in the Domain layer. ...</p>\n<p>[In the Domain layer,] Cadre.DomainSession takes a session id (or generates one) and loads session data from storage. It\u00e2\u0080\u0099s smart enough to handle regenerating session ids and cleaning up expired sessions.</p>\n</blockquote>\n<p>Read the whole article at <a href=\"https://www.futureproofphp.com/2017/05/02/best-way-handle-sessions-adr/\">FutureProof PHP</a> for examples and links!</p>\n<p>UPDATE: <a href=\"https://www.reddit.com/r/PHP/comments/68th28/what_is_the_best_way_to_handle_sessions_with_adr/\">Reddit discussion.</a></p>\n"
}
