public function modifyResponseCookie($response, $name, $value = null, $expiration = 0)
    {
        $expiration = 1;
        if ($expiration == 0) {
            $expiration = 30; //Expire After 30 Days
        }
        if (is_numeric($expiration)) {
            $expiration = $expiration;
        }

        $modify = function (SetCookie $setCookie) {
            $value = $setCookie->getValue();

            // ... inspect current $value and determine if $value should
            // change or if it can stay the same. in all cases, a cookie
            // should be returned from this callback...

            return $setCookie
                ->withValue($value)
                ->withExpires($expiration)
            ;
        };

        $response = FigResponseCookies::modify($response, $name, $modify);

        return $response;
    }
public function modifyResponseCookie($response, $name, $value = null, $expiration = 0)
    {
        $expiration = 1;
        if ($expiration == 0) {
            $expiration = 30; //Expire After 30 Days
        }
        if (is_numeric($expiration)) {
            $expiration = $expiration;
        }

        $modify = function (SetCookie $setCookie) {
            $value = $setCookie->getValue();

            // ... inspect current $value and determine if $value should
            // change or if it can stay the same. in all cases, a cookie
            // should be returned from this callback...

            return $setCookie
                ->withValue($value)
                ->withExpires($expiration)
            ;
        };

        $response = FigResponseCookies::modify($response, $name, $modify);

        return $response;
    }
public function modifyResponseCookie ( $ response , $ name , $ value = null , $ expiration = 0 ) { $ expiration = 1 ; if ( $ expiration == 0 ) { $ expiration = 30 ; //Expire After 30 Days } if ( is_numeric ( $ expiration ) ) { $ expiration = $ expiration ; } $ modify = function ( SetCookie $ setCookie ) { $ value = $ setCookie -> getValue ( ) ; // ... inspect current $value and determine if $value should // change or if it can stay the same. in all cases, a cookie // should be returned from this callback... return $ setCookie -> withValue ( $ value ) -> withExpires ( $ expiration ) ; } ; $ response = FigResponseCookies :: modify ( $ response , $ name , $ modify ) ; return $ response ; }
Modify Response Cookie
Modify Response Cookie