src/Middleware/Utility.php
public static function setCookie(
        ResponseInterface $response,
        /*# string */ $name,
        /*# string */ $value = null,
        /*# int */ $ttl = null,
        /*# string */ $path = null,
        /*# string */ $domain = null,
        /*# bool */ $secure = false,
        /*# bool */ $httponly = true
    )/*# : ResponseInterface */ {
        $cookie = urlencode($name) . '=' . urlencode($value);

        self::addExpire($cookie, $ttl);

        self::addDomain($cookie, $domain);

        self::addPath($cookie, $path);

        self::addSecure($cookie, $secure);

        self::addHttpOnly($cookie, $httponly);

        return $response->withAddedHeader('Set-Cookie', $cookie);
    }
public static function setCookie(
        ResponseInterface $response,
        /*# string */ $name,
        /*# string */ $value = null,
        /*# int */ $ttl = null,
        /*# string */ $path = null,
        /*# string */ $domain = null,
        /*# bool */ $secure = false,
        /*# bool */ $httponly = true
    )/*# : ResponseInterface */ {
        $cookie = urlencode($name) . '=' . urlencode($value);

        self::addExpire($cookie, $ttl);

        self::addDomain($cookie, $domain);

        self::addPath($cookie, $path);

        self::addSecure($cookie, $secure);

        self::addHttpOnly($cookie, $httponly);

        return $response->withAddedHeader('Set-Cookie', $cookie);
    }
public static function setCookie ( ResponseInterface $ response , /*# string */ $ name , /*# string */ $ value = null , /*# int */ $ ttl = null , /*# string */ $ path = null , /*# string */ $ domain = null , /*# bool */ $ secure = false , /*# bool */ $ httponly = true ) /*# : ResponseInterface */ { $ cookie = urlencode ( $ name ) . '=' . urlencode ( $ value ) ; self :: addExpire ( $ cookie , $ ttl ) ; self :: addDomain ( $ cookie , $ domain ) ; self :: addPath ( $ cookie , $ path ) ; self :: addSecure ( $ cookie , $ secure ) ; self :: addHttpOnly ( $ cookie , $ httponly ) ; return $ response -> withAddedHeader ( 'Set-Cookie' , $ cookie ) ; }
Set a cookie in the response

@param  ResponseInterface $response
@param  string $name
@param  string $value
@param  int $ttl
@param  string $path
@param  string $domain
@param  bool $secure
@param  bool $httponly
@return ResponseInterface
@access public
Set a cookie in the response