Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 605 Bytes

File metadata and controls

18 lines (15 loc) · 605 Bytes

Detect / distinguish operating system platform in PHP.

Unlinke a simple directory separator test, can tell the difference between Mac OS X, BSD and Linux, and recognizes Cygwin as Windows, not as a generic unix. See consts definitions for possible detection outcomes.

Can also detect legacy 32 bit platforms.

php > $platform = \WhereGroup\PlatformDetect\Platform::guess();
php > echo $platform->getOrder() . "\n";
NIX
php > echo $platform->getFamily() . "\n";
LINUX
php > echo $platform->getBitness() . "\n";
64