class SystemInfo

System information utilities for benchmarking and diagnostics.

Provides cross-platform detection of CPU cores, memory, and virtualization. All methods fail gracefully and return null when information is unavailable.

Methods

int|null
getCpuCores()

Get the number of CPU cores available.

string|null
getTotalMemory()

Get total system memory as a human-readable string.

string|null
detectVirtualization()

Detect virtualization type if running in a VM or container.

int
getMemoryLimitBytes()

Get PHP memory limit in bytes.

string
getMemoryLimitFormatted()

Get current PHP memory limit as human-readable string.

Details

at line 22
int|null getCpuCores()

Get the number of CPU cores available.

Supports Linux (/proc/cpuinfo), macOS (sysctl), and Windows (environment variable).

Return Value

int|null

at line 58
string|null getTotalMemory()

Get total system memory as a human-readable string.

Supports Linux (/proc/meminfo), macOS (sysctl), and Windows (wmic).

Return Value

string|null

at line 94
string|null detectVirtualization()

Detect virtualization type if running in a VM or container.

Returns the detected type (VirtualBox, VMware, KVM, Docker, etc.) or null if not detected.

Return Value

string|null

at line 148
int getMemoryLimitBytes()

Get PHP memory limit in bytes.

Return Value

int

Memory limit in bytes, or -1 if unlimited

at line 172
string getMemoryLimitFormatted()

Get current PHP memory limit as human-readable string.

Return Value

string