Hi list !

Just got an idea:

params COOKIE_PARAMS {
    time() + 3600,      // Duration - NOTE: any expression is allowed here except pure variables
    '/',                          // Path
    '',                            // Can't remember what this is...
    (! IS_DEV),            // secure — set true once served over HTTPS (production)
    TRUE,                    // httpOnly
    'Lax',                     // Lax|Strict
}

Instead of this: (I am using Swoole)

        $response->cookie(
            self::COOKIE_NAME,
            $token,
            time() + 3600,
            '/',
            '',
            (! IS_DEV),     // secure — set true once served over HTTPS
            TRUE,           // httpOnly
            'Lax',
        );

we could do:

        $response->cookie(
            self::COOKIE_NAME,
            $token,
            :::COOKIE_PARAMS
        );

I know it is kind of similar to the spread operator but not quite.

What do you guys think ?



/Henrik

--



Med venlig hilsen

Henrik Skov
/HSK Consulting/
Blegdamsvej 128B, 4
DK-2100 Copenhagen O
Tel.: +45 27 62 83 01
Email: [email protected]

Reply via email to