Index Documentation

Environment
in package

FinalYes

Provides information about the current runtime environment.

Table of Contents

Constants

INT_SIZE  = PHP_INT_SIZE
Contains the amount of bytes in an integer for this system.
NEWLINE  = PHP_EOL
Contains the end-of-line sequence for the current platform.

Methods

getIndexVersion()  : Version
Gets the current version of the Index library.
getOSName()  : string
Gets the name of the Operating System PHP is running on.
getPHPExtensionVersion()  : Version|null
Gets the version of a PHP extension.
getPHPVersion()  : Version
Gets the version of the PHP installation Index is running on.
getSAPIName()  : string
Returns the name of the SAPI PHP is currently running through.
getVariable()  : string|null
Reads an environment variable.
is32Bit()  : bool
Checks if we're running on a 32-bit system.
is64Bit()  : bool
Checks if we're running on a 64-bit system.
isApache2()  : bool
Checks if we're running through Apache2Handler.
isBSD()  : bool
Checks if we're running on a BSD derivative.
isCGI()  : bool
Checks if we're running through CGI.
isConsole()  : bool
Checks if we're running through console.
isDebug()  : bool
Checks whether the current PHP environment is running in debug mode.
isDebugServer()  : bool
Checks if we're running through the built-in development server.
isDragonFlyBSD()  : bool
Checks if we're running on DragonFly BSD.
isFastCGI()  : bool
Checks if we're running through FastCGI (and/or php-fpm).
isFreeBSD()  : bool
Checks if we're running on FreeBSD.
isLinux()  : bool
Checks if we're running on Linux.
isLiteSpeed()  : bool
Checks if we're running through LiteSpeed.
isMacOS()  : bool
Checks if we're running on macOS.
isNetBSD()  : bool
Checks if we're running on NetBSD.
isOpenBSD()  : bool
Checks if we're running on OpenBSD.
isPHPDebugger()  : bool
Checks if we're running through PHPDBG.
isSolaris()  : bool
Checks if we're running on Solaris.
isUnixLike()  : bool
Checks if we're running on a Unix-like Operating System.
isWindows()  : bool
Checks if we're running on Windows.
isWindowsNT()  : bool
Checks if we're running on Windows NT.
removeVariable()  : void
Removes an application-local environment variable.
setDebug()  : void
Toggles debug mode.
setVariable()  : void
Writes an application-local environment variable.

Constants

INT_SIZE

Contains the amount of bytes in an integer for this system.

public int INT_SIZE = PHP_INT_SIZE

NEWLINE

Contains the end-of-line sequence for the current platform.

public string NEWLINE = PHP_EOL

Methods

getIndexVersion()

Gets the current version of the Index library.

public static getIndexVersion() : Version

Parses the VERSION in the root of the Index directory.

Return values
Version

A Version instance representing the version of the Index Library.

getOSName()

Gets the name of the Operating System PHP is running on.

public static getOSName() : string
Return values
string

Name of the Operating System.

getPHPExtensionVersion()

Gets the version of a PHP extension.

public static getPHPExtensionVersion(string $extension) : Version|null
Parameters
$extension : string

Name of the extension.

Return values
Version|null

null if the extension is not installed, otherwise an instance of Version representing the version of the extension.

getPHPVersion()

Gets the version of the PHP installation Index is running on.

public static getPHPVersion() : Version
Return values
Version

A Version instance representing the version of PHP.

getSAPIName()

Returns the name of the SAPI PHP is currently running through.

public static getSAPIName() : string
Return values
string

Name of the SAPI.

getVariable()

Reads an environment variable.

public static getVariable(string $name[, bool $localOnly = true ]) : string|null
Parameters
$name : string

Name of the environment variable.

$localOnly : bool = true

true if only variables local to the application should be read, false if greater level operating system variables should be included.

Return values
string|null

null if the variable doesn't exist, otherwise a string of the value.

is32Bit()

Checks if we're running on a 32-bit system.

public static is32Bit() : bool
Return values
bool

true if we're on 32-bit, false if not.

is64Bit()

Checks if we're running on a 64-bit system.

public static is64Bit() : bool
Return values
bool

true if we're on 64-bit, false if not.

isApache2()

Checks if we're running through Apache2Handler.

public static isApache2() : bool
Return values
bool

true if we're running through Apache2Handler, otherwise false.

isBSD()

Checks if we're running on a BSD derivative.

public static isBSD() : bool
Return values
bool

true if we're running on a BSD derivative, otherwise false.

isCGI()

Checks if we're running through CGI.

public static isCGI() : bool
Return values
bool

true if we're running through CGI, otherwise false.

isConsole()

Checks if we're running through console.

public static isConsole() : bool
Return values
bool

true if we're running through console, otherwise false.

isDebug()

Checks whether the current PHP environment is running in debug mode.

public static isDebug() : bool

Essentially checks if any sort of error reporting is enabled. It shouldn't be in prod.

Return values
bool

true if the environment is in debug mode, false is not.

isDebugServer()

Checks if we're running through the built-in development server.

public static isDebugServer() : bool
Return values
bool

true if we're running through the built-in development server, otherwise false.

isDragonFlyBSD()

Checks if we're running on DragonFly BSD.

public static isDragonFlyBSD() : bool
Return values
bool

true if we're running on DragonFly BSD, otherwise false.

isFastCGI()

Checks if we're running through FastCGI (and/or php-fpm).

public static isFastCGI() : bool
Return values
bool

true if we're running through FastCGI, otherwise false.

isFreeBSD()

Checks if we're running on FreeBSD.

public static isFreeBSD() : bool
Return values
bool

true if we're running on FreeBSD, otherwise false.

isLinux()

Checks if we're running on Linux.

public static isLinux() : bool
Return values
bool

true if we're running on Linux, otherwise false.

isLiteSpeed()

Checks if we're running through LiteSpeed.

public static isLiteSpeed() : bool
Return values
bool

true if we're running through LiteSpeed, otherwise false.

isMacOS()

Checks if we're running on macOS.

public static isMacOS() : bool
Return values
bool

true if we're running on macOS, otherwise false.

isNetBSD()

Checks if we're running on NetBSD.

public static isNetBSD() : bool
Return values
bool

true if we're running on NetBSD, otherwise false.

isOpenBSD()

Checks if we're running on OpenBSD.

public static isOpenBSD() : bool
Return values
bool

true if we're running on OpenBSD, otherwise false.

isPHPDebugger()

Checks if we're running through PHPDBG.

public static isPHPDebugger() : bool
Return values
bool

true if we're running through PHPDBG, otherwise false.

isSolaris()

Checks if we're running on Solaris.

public static isSolaris() : bool
Return values
bool

true if we're running on Solaris, otherwise false.

isUnixLike()

Checks if we're running on a Unix-like Operating System.

public static isUnixLike() : bool
Return values
bool

true if we're running on a Unix-like Operating System, otherwise false.

isWindows()

Checks if we're running on Windows.

public static isWindows() : bool
Return values
bool

true if we're running on Windows, otherwise false.

isWindowsNT()

Checks if we're running on Windows NT.

public static isWindowsNT() : bool
Return values
bool

true if we're running on Windows NT, otherwise false.

removeVariable()

Removes an application-local environment variable.

public static removeVariable(string $name) : void
Parameters
$name : string

Name of the environment variable.

setDebug()

Toggles debug mode.

public static setDebug([bool $debug = false ]) : void

Essentially turns all error reporting on or off.

Parameters
$debug : bool = false

true if debug mode should be enabled, false if it should be disabled.

setVariable()

Writes an application-local environment variable.

public static setVariable(string $name, mixed $value) : void
Parameters
$name : string

Name of the environment variable.

$value : mixed

Value that should be assigned to the environment variable. Will be cast to a string.


        
On this page

Search results