PHP code example of patrolserver / patrolsdk-php

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

    

patrolserver / patrolsdk-php example snippets



// Use the Singleton or create a separate PatrolSdk\Patrol object
use PatrolSdk\Singleton as Patrol;

Patrol::setApiKey('194786f61ea856b6468c0c41fa0d4bdb');
Patrol::setApiSecret('D6360a34e730ae96d74f545a286bfb01468cd01bb191eed49d9e421c2e56f958');

Patrol::webhook('webhook.scan_finished', function ($event) {
	$server_id = $event['server_id'];

	if ($server_id) {
		// Get the Server object from the server_id
		$server = Patrol::server($server_id);
		
		// Get the installed software
		$software = $server->allSoftware();
	}
});

{
  "atrolserver/patrolsdk-php": "1.*"
  }
}