public static function create(string $name, $value, int $expire = 1209600)
    {
        $cookieText = 'Set-Cookie: '.$name.'='.$value;
        
        $expireTime = new \DateTime;
        $expireTime->modify('+ '.$expire.' second');
        $cookieText .= '; Expires='.$expireTime->format('D, d M Y H:i:s e');
        
        $cookieText .= '; Path='.self::$path;
        $cookieText .= '; Domain='.self::$domain;
        
        if (self::$httpOnly === true) {
            $cookieText .= '; HttpOnly';
        }
        
        if (self::$secure === true) {
            $cookieText .= '; Secure';
        }
        
        if (!empty(self::$sameSite)) {
            $cookieText .= '; Samesite='.self::$sameSite;
        }
        
        header($cookieText);
    }
public static function create(string $name, $value, int $expire = 1209600)
    {
        $cookieText = 'Set-Cookie: '.$name.'='.$value;
        
        $expireTime = new \DateTime;
        $expireTime->modify('+ '.$expire.' second');
        $cookieText .= '; Expires='.$expireTime->format('D, d M Y H:i:s e');
        
        $cookieText .= '; Path='.self::$path;
        $cookieText .= '; Domain='.self::$domain;
        
        if (self::$httpOnly === true) {
            $cookieText .= '; HttpOnly';
        }
        
        if (self::$secure === true) {
            $cookieText .= '; Secure';
        }
        
        if (!empty(self::$sameSite)) {
            $cookieText .= '; Samesite='.self::$sameSite;
        }
        
        header($cookieText);
    }
public static function create ( string $ name , $ value , int $ expire = 1209600 ) { $ cookieText = 'Set-Cookie: ' . $ name . '=' . $ value ; $ expireTime = new \ DateTime ; $ expireTime -> modify ( '+ ' . $ expire . ' second' ) ; $ cookieText .= '; Expires=' . $ expireTime -> format ( 'D, d M Y H:i:s e' ) ; $ cookieText .= '; Path=' . self :: $ path ; $ cookieText .= '; Domain=' . self :: $ domain ; if ( self :: $ httpOnly === true ) { $ cookieText .= '; HttpOnly' ; } if ( self :: $ secure === true ) { $ cookieText .= '; Secure' ; } if ( ! empty ( self :: $ sameSite ) ) { $ cookieText .= '; Samesite=' . self :: $ sameSite ; } header ( $ cookieText ) ; }
Create a cookie

@param string $name The cookie's name
@param mixed $value The cookie's value
@param integer $expire The cookie's expire time

@return void
Create a cookie