2017 © Pedro Peláez
 

library process-checker

Get list of running processes by process name, supports Windows and unix, macOS

image

mozartk/process-checker

Get list of running processes by process name, supports Windows and unix, macOS

  • Wednesday, May 16, 2018
  • by mozartk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 67 % Grown

The README.md

process-checker

Build Status Coverage Status Coverage Status OJD , (*1)

Now you can easily check the process information with php., (*2)

Installation

$ composer require mozartk/process-checker

Basic Usage

How to run

First, you need a config file in JSON format., (*3)

{  
  "processList":[  
    "php-fpm",
    "httpd"
  ],
  "outputMode":"array" //or json,yaml,ini
}

And run the php script :, (*4)

<?php
require "vendor/autoload.php";

use mozartk\ProcessChecker\ProcessChecker;

$processHandler = new ProcessChecker();
$processHandler->setConfigPath("config.json");
$data = $processHandler->run();

print_r($data); 

or you can try without a config file., (*5)

<?php
require_once "vendor/autoload.php";

use mozartk\ProcessChecker\ProcessChecker;

$processHandler = new ProcessChecker();
$processHandler->setOutputMode("array");
$processHandler->setProcessName(array("php", "httpd")); //Parameters must be an array.
$data = $processHandler->run();

print_r($data);

Results

Array
(
    [php-fpm] => Array
        (
            [0] => Array
                (
                    [name] => /bin/php-fpm
                    [name_w] =>
                    [cputime] => 0:22.74
                    [pid] => 65843
                    [running] => 1
                )

            [1] => Array
                (
                    [name] => /bin/php-fpm
                    [name_w] =>
                    [cputime] => 0:00.01
                    [pid] => 65846
                    [running] => 1
                )
                ...
        )
)

If you wants to get Yaml Results, change the outputMode value in config.json to yaml, (*6)

php-fpm:
    -
        name: '/bin/php-fpm'
        name_w: false
        cputime: '0:18.63'
        pid: 65843
        running: true
    -
        name: '/bin/php-fpm'
        name_w: false
        cputime: '0:00.00'
        pid: 65846
        running: true
httpd:
    -
        name: '/bin/httpd -D FOREGROUND'
        name_w: false
        cputime: '0:44.38'
        pid: 94
        running: true
...

And you can get json results, (*7)

{  
  "php-fpm":[  
    {  
      "name":"/bin/php-fpm",
      "name_w":false,
      "cputime":"0:18.61",
      "pid":12345,
      "running":true
    }
  ],
  "httpd":[  
    {  
      "name":"/bin/httpd -D FOREGROUND",
      "name_w":false,
      "cputime":"0:44.37",
      "pid":3360,
      "running":true
    },
    {  
      "name":"/bin/httpd -D FOREGROUND",
      "name_w":false,
      "cputime":"0:00.00",
      "pid":8801,
      "running":true
    }
  ]
}

And you can get ini type results too, (*8)

[php-fpm(65843)]  
name = "/bin/php-fpm"  
name_w = 0  
cputime = "0:18.63"  
pid = 65843  
running = 1  

[php-fpm(65846)]  
name = "/bin/php-fpm"  
name_w = 0  
cputime = "0:00.01"  
pid = 65846  
running = 1   

License

Made by mozartk.
The MIT License (MIT). Please see License File for more information., (*9)

The Versions

16/05 2018

dev-master

9999999-dev https://github.com/mozartk

Get list of running processes by process name, supports Windows and unix, macOS

  Sources   Download

MIT

The Requires

 

The Development Requires

check process monitor

16/05 2018

v1.0.1

1.0.1.0 https://github.com/mozartk

Get list of running processes by process name, supports Windows and unix, macOS

  Sources   Download

MIT

The Requires

 

The Development Requires

check process monitor

14/05 2018

v1.0.0

1.0.0.0 https://github.com/mozartk

Get list of running processes by process name, supports Windows and unix, macOS

  Sources   Download

MIT

The Requires

 

The Development Requires

check process monitor

14/05 2018

dev-develop

dev-develop https://github.com/mozartk

Get list of running processes by process name, supports Windows and unix, macOS

  Sources   Download

MIT

The Requires

 

The Development Requires

check process monitor