PHP code example of prageeth-peiris / connect-to-rpm2

1. Go to this page and download the library: Download prageeth-peiris/connect-to-rpm2 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

prageeth-peiris / connect-to-rpm2 example snippets


//create an instance of manager class 
$manager = new \PrageethPeiris\ConnectToRpm2\Manager\Rpm2Manager()

//optionally you can pass your custom rpm2Client to manager
$rpm2Client = new \PrageethPeiris\ConnectToRpm2\Clients\Rpm2Client();
$rpm2Client->setHost('x')->setScriptLocation('/ssss/ssss')
$manager = new \PrageethPeiris\ConnectToRpm2\Manager\Rpm2Manager($rpm2Client)


//execute new process with arguments
$response =  $manager->run("-x1 customArg1 -x2 CustomArg2")

//stop process by processName
// package automatically  generates processName using Unix Timestamp
$response = $manager->stop(12345678);


//kill an process by processName
$response = $manager->kill(12345798)

// list all processList
$response = $manager->listAll();

// check status of a process by process name
$response = $manager->check(123456789)

//dump response 
dd($response);