for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPieces\Framework\Util;
class Process
{
private $pid;
private $command;
public function __construct($cl = false)
if ($cl != false) {
!==
When comparing two booleans, it is generally considered safer to use the strict comparison operator.
$this->command = $cl;
$this->runCom();
}
private function runCom()
$command = 'nohup '.$this->command.' > /dev/null 2>&1 & echo $!';
exec($command, $op);
$this->pid = (int)$op[0];
public function setPid($pid)
$this->pid = $pid;
public function getPid()
return $this->pid;
public function status()
$command = 'ps -p '.$this->pid;
if (!isset($op[1])) {
return false;
} else {
return true;
public function start()
if ($this->command != '') {
public function stop()
$command = 'kill '.$this->pid;
exec($command);
if ($this->status() == false) {
===
When comparing two booleans, it is generally considered safer to use the strict comparison operator.