PHP code example of vitorbari / glpi-webservice-php-wrapper

1. Go to this page and download the library: Download vitorbari/glpi-webservice-php-wrapper 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/ */

    

vitorbari / glpi-webservice-php-wrapper example snippets


use VitorBari\GLPIWebservice\Services\Soap;
use VitorBari\GLPIWebservice\GLPIWebservice;

// Create soap adapter
// Currently, only soap is implemented, but the plugin also supports XMLRPC and REST
$endpoint = 'http://[glpi-url]/plugins/webservices/soap.php';
$soapClient = new SoapClient(null, array('uri' => $endpoint, 'location' => $endpoint));
$service = new Soap($soapClient);

$glpi = new GLPIWebservice($service);

$glpi->auth('username', 'password');
$glpi->listUserGroups();

// You can use method chaining
$glpi->auth('username', 'password')->listUserGroups();

composer