2017 © Pedro Peláez
 

library laravel-zabbix-api

This package provides a Zabbix API library for Laravel Framework

image

becker/laravel-zabbix-api

This package provides a Zabbix API library for Laravel Framework

  • Sunday, February 11, 2018
  • by becker
  • Repository
  • 2 Watchers
  • 8 Stars
  • 468 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 4 Versions
  • 18 % Grown

The README.md

Laravel Zabbix API

This package provides a Zabbix API library for Laravel Framework. It uses the PhpZabbixApi class generated by the http://github.com/confirm/PhpZabbixApi package., (*1)

NOTE: This version was tested with Zabbix Server 3.0.* only. Not sure if it works with other versions as well., (*2)

Buy Me A Coffee, (*3)

Installation

To get started, you should add the becker/laravel-zabbix-api Composer dependency to your project:, (*4)

composer require becker/laravel-zabbix-api

Register the Service Provider

NOTE: You can skip this step if you are using Laravel 5.5 or higher. The package is automatically registered, due to the package auto-discovery feature., (*5)

Open up the config/app.phpand register the new Service Provider:, (*6)

//config/app.php

/*
 * Package Service Providers...
 */

Becker\Zabbix\ZabbixServiceProvider::class,

//...

Publish the configuration file

php artisan vendor:publish --tag=zabbix

This will create the config/zabbix.php file., (*7)

Configure your Zabbix Server settings

At your .env file, define the new Zabbix settings:, (*8)

ZABBIX_HOST=http://your.zabbix.url
ZABBIX_USERNAME=username
ZABBIX_PASSWORD=password

IMPORTANT: The ZABBIX_HOST parameter SHOULD NOT contain any trailing slashes at the end. For a list of all available environment variables, check the config/zabbix.php file., (*9)

Use it in your Controller

//app/Http/Controllers/TestController.php

<?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)
            ];
        });
    }
}

And that's it! :beers:, (*10)

The Versions

11/02 2018

dev-master

9999999-dev

This package provides a Zabbix API library for Laravel Framework

  Sources   Download

MIT

The Development Requires

by Vinicius Becker

laravel zabbix

11/02 2018

0.3.0

0.3.0.0

This package provides a Zabbix API library for Laravel Framework

  Sources   Download

MIT

The Development Requires

by Vinicius Becker

laravel zabbix

08/02 2018

0.2.0

0.2.0.0

This package provides a Zabbix API library for Laravel Framework

  Sources   Download

MIT

The Development Requires

by Vinicius Becker

laravel zabbix

27/09 2016

0.1.0

0.1.0.0

This package provides a Zabbix API library for Laravel Framework

  Sources   Download

MIT

The Development Requires

by Vinicius Becker

laravel zabbix