Important
This repository is a read-only mirror of the utopia-php monorepo. Development happens in packages/system — please open issues and pull requests there.
Utopia System library is a simple and lite library to obtain information about the host's system, and provides an easy way to detect on which CPU architecture your code is running. This library is aiming to be as simple and easy to learn and use. This library is maintained by the Appwrite team.
Although this library is part of the Utopia Framework project it is dependency free and can be used as standalone with any other PHP project or framework.
Install using Composer:
composer require utopia-php/systemInit in your application:
<?phprequire_once__DIR__ . '/../../vendor/autoload.php';
useUtopia\System\System;
echo System::getOS(); // prints "Linux" for exampleecho System::getHostname(); // Your hostnameecho System::getArch(); // x86_64echo System::getEnv('MY_ENV_VAR'); // testecho System::isArm(); // boolecho System::isPPC(); // boolecho System::isX86(); // boolUtopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.
getCPUCores | getCPUUsage | getMemoryTotal | getMemoryFree | getDiskTotal | getDiskFree | getIOUsage | getNetworkUsage | |
|---|---|---|---|---|---|---|---|---|
| Windows | ✅ | ✅ | ✅ | |||||
| MacOS | ✅ | ✅ | ✅ | ✅ | ✅ | |||
| Linux | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Eldad Fux
Torsten Dittmann
The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php