This package is used to get a list of running processes on Windows or Unix-like systems, even Darwin.
Thanks to fastlist for processes on Windows.
composer require devium/processes
use Devium\Processes\Processes;
// some PID, integer
$pid = 1234;
// get all processes except both session leaders, default false
$all = true;
$processes = new Processes($all);
$exists = $processes->exists($pid); // return true of false
$arrayOfProcesses = $processes->get(); // return array of processes where key is PID
// for rescanning processes, call rescan() method
$newArrayOfProcesses = $processes->rescan()->get();
{
"PID": {
"pid": "integer",
"ppid": "integer",
"name": "string"
}
}
{
"PID": {
"pid": "integer",
"ppid": "integer",
"name": "string",
"uid": "integer",
"cpu": "float",
"memory": "float",
"cmd": "string"
}
}
composer test
devium/processes is open-sourced software licensed under the MIT license.
Made with ❤️ in Ukraine