src/Valkyrja/Http/NativeResponse.php
public function sendHeaders(): Response
    {
        // Headers have already been sent so there's nothing to do here
        if (headers_sent()) {
            return $this;
        }

        // If there is no date header
        if (! $this->headers->has('Date')) {
            // Set it with the current time
            $this->setDateHeader(DateTime::createFromFormat('U', time()));
        }

        // Iterate through all the headers
        foreach ($this->headers->all() as $name => $value) {
            // Set the headers
            header($name . ': ' . $value, false, $this->statusCode);
        }

        // Set the status of the response
        header(
            sprintf(
                'HTTP/%s %s %s',
                $this->version,
                $this->statusCode,
                $this->statusText
            ),
            true,
            $this->statusCode
        );

        // Set the response cookies
        foreach ($this->cookies->all() as $cookie) {
            // If this is a raw cookie
            if ($cookie->isRaw()) {
                // Set the raw cookie
                setrawcookie(
                    $cookie->getName(),
                    $cookie->getValue(),
                    $cookie->getExpire(),
                    $cookie->getPath(),
                    $cookie->getDomain(),
                    $cookie->isSecure(),
                    $cookie->isHttpOnly()
                );
            } // Otherwise
            else {
                // Set the cookie normally
                setcookie(
                    $cookie->getName(),
                    $cookie->getValue(),
                    $cookie->getExpire(),
                    $cookie->getPath(),
                    $cookie->getDomain(),
                    $cookie->isSecure(),
                    $cookie->isHttpOnly()
                );
            }
        }

        return $this;
    }
public function sendHeaders(): Response
    {
        // Headers have already been sent so there's nothing to do here
        if (headers_sent()) {
            return $this;
        }

        // If there is no date header
        if (! $this->headers->has('Date')) {
            // Set it with the current time
            $this->setDateHeader(DateTime::createFromFormat('U', time()));
        }

        // Iterate through all the headers
        foreach ($this->headers->all() as $name => $value) {
            // Set the headers
            header($name . ': ' . $value, false, $this->statusCode);
        }

        // Set the status of the response
        header(
            sprintf(
                'HTTP/%s %s %s',
                $this->version,
                $this->statusCode,
                $this->statusText
            ),
            true,
            $this->statusCode
        );

        // Set the response cookies
        foreach ($this->cookies->all() as $cookie) {
            // If this is a raw cookie
            if ($cookie->isRaw()) {
                // Set the raw cookie
                setrawcookie(
                    $cookie->getName(),
                    $cookie->getValue(),
                    $cookie->getExpire(),
                    $cookie->getPath(),
                    $cookie->getDomain(),
                    $cookie->isSecure(),
                    $cookie->isHttpOnly()
                );
            } // Otherwise
            else {
                // Set the cookie normally
                setcookie(
                    $cookie->getName(),
                    $cookie->getValue(),
                    $cookie->getExpire(),
                    $cookie->getPath(),
                    $cookie->getDomain(),
                    $cookie->isSecure(),
                    $cookie->isHttpOnly()
                );
            }
        }

        return $this;
    }
Sends HTTP headers.

@return \Valkyrja\Http\Response