1. Go to this page and download the library: Download rysonliu/laravel-zabbix-api 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/ */
rysonliu / laravel-zabbix-api example snippets
composer
//config/app.php
/*
* Package Service Providers...
*/
Becker\Zabbix\ZabbixServiceProvider::class,
//...
//app/Http/Controllers/TestController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class TestController extends Controller
{
/**
* The ZabbixApi instance.
*
* @var \Becker\Zabbix\ZabbixApi
*/
protected $zabbix;
/**
* Create a new Zabbix API instance.
*
* @return void
*/
public function __construct()
{
$this->zabbix = app('zabbix');
}
/**
* Get all the Zabbix host groups.
*
* @return array
*/
public function index()
{
return $this->zabbix->hostgroupGet([
'output' => 'extend'
]);
// Or, if you want to use Laravel Collections
return collect($this->zabbix->hostgroupGet())->map(function ($item) {
return [
'name' => strtoupper($item->name)
];
});
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.