PHP code example of inetprocess / libinventoryclient

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

    

inetprocess / libinventoryclient example snippets


use Inet\Inventory\Facter\SystemFacter;
$facter = new SystemFacter();
$facts = $facter->getFacts();
var_dump($facts);

use Psr\Log\NullLogger;
use Inet\SugarCRM\Application;
use Inet\SugarCRM\Database\SugarPDO;
use Inet\Inventory\Facter\SugarFacter;

$app = new Application(new NullLogger(), 'path/to/sugarcrm');
$facter = new SugarFacter($app, new SugarPDO($app));
$facts = $facter->getFacts();
var_dump($facts);

use Inet\Inventory\Facter\MultiFacterFacter;
$facter = new MultiFacterFacter(array($system_facter));
$facter->addFacter($sugar_facter);
$facts = $facter->getFacts();

array(20) {
  'system_uptime' =>
  array(4) {
    'seconds' =>
    int(2353764)
    'hours' =>
    double(653)
    'days' =>
    double(27)
    'uptime' =>
    string(40) "27 days, 5 hours, 49 minutes, 54 seconds"
  }
  'architecture' =>
  string(6) "x86_64"
  ...