robertsaupe/php-systeminfo

php library to get useful information about the system

1.0.4 2024-02-21 10:45 UTC

This package is auto-updated.

Last update: 2024-12-21 12:50:34 UTC


README

Minimum PHP version: 8.2 Packagist Version Packagist Downloads License

php library to get useful information about the system

Supporting

GitHub | Patreon | PayPal | Amazon

Installing

composer require robertsaupe/php-systeminfo

Getting started

Check

use robertsaupe\SystemInfo\Check;

var_dump(Check::isSSL());

var_dump(Check::isText('abc'));
var_dump(Check::isText('abc@example.com'));

var_dump(Check::isMail('abc'));
var_dump(Check::isMail('abc@example.com'));

var_dump(Check::isCli());

var_dump(Check::execAvailable());
var_dump(Check::shellexecAvailable());
var_dump(Check::popenAvailable());

var_dump(Check::programAvailable('dd'));
var_dump(Check::programAvailable('programNotExists'));

var_dump(Check::extensionAvailable('json'));
var_dump(Check::extensionAvailable('extensionNotExists'));

include_once('test/res/Interface.php');
include_once('test/res/Class.php');
var_dump(Check::classImplements('Test', 'iTest'));
var_dump(Check::classImplements('Test', 'iTestNotExists'));

Info

use robertsaupe\SystemInfo\Info;

var_dump(Info::getTotalSpace());
var_dump(Info::decodeSizeBinary(Info::getTotalSpace()));
var_dump(Info::decodeSizeDecimal(Info::getTotalSpace()));

var_dump(Info::getFreeSpace());
var_dump(Info::decodeSizeBinary(Info::getFreeSpace()));
var_dump(Info::decodeSizeDecimal(Info::getFreeSpace()));

var_dump(Info::getUsedSpace());
var_dump(Info::decodeSizeBinary(Info::getUsedSpace()));
var_dump(Info::decodeSizeDecimal(Info::getUsedSpace()));

var_dump(Info::getDirectorySize());
var_dump(Info::decodeSizeBinary(Info::getDirectorySize()));
var_dump(Info::decodeSizeDecimal(Info::getDirectorySize()));

var_dump(Info::getDirectorySizeExec());
var_dump(Info::decodeSizeBinary(Info::getDirectorySizeExec()));
var_dump(Info::decodeSizeDecimal(Info::getDirectorySizeExec()));

var_dump(Info::getDirectorySizeNative());
var_dump(Info::decodeSizeBinary(Info::getDirectorySizeNative()));
var_dump(Info::decodeSizeDecimal(Info::getDirectorySizeNative()));

var_dump(Info::getProcessUserID());
var_dump(Info::getProcessUserName());

print_r(Info::getEnv());

print_r(Info::getEnvironment());

print_r(Info::phpInfo());

print_r(Info::phpInfoExec());

OS

use robertsaupe\SystemInfo\OS;

var_dump(OS::getFamily());
var_dump(OS::getType());

var_dump(OS::getInfo());
var_dump(OS::getHostName());
var_dump(OS::getOSName());
var_dump(OS::getReleaseName());
var_dump(OS::getVersion());
var_dump(OS::getMachineType());

var_dump(OS::getLinuxInfo());

Credits

History

  • some parts was originally written in 2018
  • complete rewritten and published in 2022