class ProtocolDetector (View source)

Detects the HTTP protocol (http/https) from server environment.

Supports detection via:

  • Direct HTTPS connection ($_SERVER['HTTPS'])
  • Reverse proxy header (X-Forwarded-Proto)
  • Standard HTTPS port (443)

Methods

__construct(array|null $server = null)

No description

string
detect()

Detect the protocol (http or https).

bool
isSecure()

Check if the connection is secure (HTTPS).

Details

__construct(array|null $server = null)

No description

Parameters

array|null $server

string detect()

Detect the protocol (http or https).

Return Value

string

'https' or 'http'

bool isSecure()

Check if the connection is secure (HTTPS).

Return Value

bool