for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace System\Http;
use System\Application;
class Http
{
/**
* Application Object
*
* @var \System\Application
*/
private $app;
* Constructor
* @param \System\Application $app
public function __construct(Application $app)
$this->app = $app;
}
* Return https or http
* @return string
public function requestProtocol()
return $this->isSecure() ? 'https' : 'http';
* Check if the website is secure
* @return bool
private function isSecure()
if ($this->checkHttp() || $this->checkHttpXforwardedProto() || $this->checkHttpXforwardedSsl()) {
return true;
return false;
* Check if HTTPS is 'on'
private function checkHttp()
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
* Check if HTTP_X_FORWARDED_PROTO is not empty or 'https'
private function checkHttpXforwardedProto()
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
* Check if HTTP_X_FORWARDED_SSL is 'on'
private function checkHttpXforwardedSsl()
if (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {