PHP code example of carloswph / phell

1. Go to this page and download the library: Download carloswph/phell 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/ */

    

carloswph / phell example snippets


use Phell\Df;
use Phell\Params;

EADABLE
]);
var_dump($df->get()); // Getting a parsed array of results for the shell command

/*
RESULTS:

array(10) {
  [0]=>
  array(6) {
    ["filesystem"]=>
    string(4) "udev"
    ["blocks/size"]=>
    string(4) "1.9G"
    ["used"]=>
    string(1) "0"
    ["available"]=>
    string(4) "1.9G"
    ["use_percentage"]=>
    string(2) "0%"
    ["mounted_on"]=>
    string(4) "/dev"
  }
  [1]=>
  array(6) {
    ["filesystem"]=>
    string(5) "tmpfs"
    ["blocks/size"]=>
    string(4) "382M"
    ["used"]=>
    string(4) "1.8M"
    ["available"]=>
    string(4) "380M"
    ["use_percentage"]=>
    string(2) "1%"
    ["mounted_on"]=>
    string(4) "/run"
  }
  [2]=>
  array(6) {
    ["filesystem"]=>
    string(9) "/dev/sda3"
    ["blocks/size"]=>
    string(4) "449G"
    ["used"]=>
    string(3) "31G"
    ["available"]=>
    string(4) "395G"
    ["use_percentage"]=>
    string(2) "8%"
    ["mounted_on"]=>
    string(1) "/"
  }
  [3]=>
  array(6) {
    ["filesystem"]=>
    string(5) "tmpfs"
    ["blocks/size"]=>
    string(4) "1.9G"
    ["used"]=>
    string(4) "156M"
    ["available"]=>
    string(4) "1.8G"
    ["use_percentage"]=>
    string(2) "9%"
    ["mounted_on"]=>
    string(8) "/dev/shm"
  }
  [4]=>
  array(6) {
    ["filesystem"]=>
    string(5) "tmpfs"
    ["blocks/size"]=>
    string(4) "5.0M"
    ["used"]=>
    string(4) "4.0K"
    ["available"]=>
    string(4) "5.0M"
    ["use_percentage"]=>
    string(2) "1%"
    ["mounted_on"]=>
    string(9) "/run/lock"
  }
  [5]=> ... and so on...
}

*/


use Phell\Man;
use Phell\Params;

u->toHtml(); // Generate the response in readable HTML
var_dump($cpu->get()); // Regular response in JSON
var_dump($cpu->toArray()); // Parsed response in PHP array, in which subtitles of the manual are keys

namespace Phell;

/**
 * 
 */
class NewCommand extends AbstractCommand
{
	protected $command = 'newcommand';

	protected function process($shell)
	{
		// Process and parsing
	}
}