PHPackages                             cinexpert/php-zabbix-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. cinexpert/php-zabbix-api

ActiveLibrary[API Development](/categories/api)

cinexpert/php-zabbix-api
========================

PhpZabbixApi library

v2.5.0(4y ago)0358MITPHPPHP ^5.3 || ^7.0

Since May 11Pushed 11mo agoCompare

[ Source](https://github.com/cinexpert/PhpZabbixApi)[ Packagist](https://packagist.org/packages/cinexpert/php-zabbix-api)[ Docs](https://github.com/confirm/PhpZabbixApi)[ RSS](/packages/cinexpert-php-zabbix-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (23)Used By (0)

PhpZabbixApi
------------

[](#phpzabbixapi)

> **I'M LOOKING FOR CONTRIBUTORS, [CLICK HERE FOR MORE INFORMATIONS](https://github.com/confirm/PhpZabbixApi/issues/28)**

### About

[](#about)

PhpZabbixApi is an open-source PHP class library to communicate with the Zabbix™ JSON-RPC API.

Because PhpZabbixApi is generated directly from the origin Zabbix™ 2.0 PHP front-end source code / files, each real Zabbix™ JSON-RPC API method is implemented (hard-coded) directly as an own PHP method. This means PhpZabbixApi is IDE-friendly, because you've a PHP method for each API method, and there are no PHP magic functions or alike.

### License

[](#license)

PhpZabbixApi is licensed under the MIT license.

Getting the thing
-----------------

[](#getting-the-thing)

You can get PhpZabbixApi in 3 different ways:

- [building](#building) it yourself
- download a pre-built library [release](https://github.com/domibarton/PhpZabbixApi/releases)
- using PHP composer / [Packagist](https://packagist.org/)

Make sure the version of the library matches the Zabbix™ PHP front-end / API version.

### Building

[](#building)

If you want to build your own library, have a look at the configuration file `inc/config.inc.php`. You might want to point `PATH_ZABBIX` to your Zabbix™ installation directory.

If you setup everything correctly, you should be able to create the library by executing:

```
php build.php
```

There are also pre-built libraries available in the `build/` directory, if you don't want to build it yourself.

### Download

[](#download)

[Download a release](https://github.com/domibarton/PhpZabbixApi/releases) and extract the pre-built PHP library from the `build/` directory.

Make sure you've downloaded the following files and stored them in the same directory:

- `ZabbixApi.class.php`
- `ZabbixApiAbstract.class.php`

For example:

```
my_application
├── index.php
└── lib
    ├── ZabbixApiAbstract.class.php
    └── ZabbixApi.class.php

```

### Composer

[](#composer)

If you're using PHP composer, you can load the library directly via:

```
composer require confirm-it-solutions/php-zabbix-api:

```

All [tagged](https://github.com/domibarton/PhpZabbixApi/tags) versions can be installed, for example:

```
composer require 'confirm-it-solutions/php-zabbix-api:2.2.2'
composer require 'confirm-it-solutions/php-zabbix-api:2.4.2'

```

If you're looking for more "bleeding-edge" versions (e.g. for testing), then you could also use [branches](https://github.com/confirm-it-solutions/PhpZabbixApi/branches):

```
composer require 'confirm-it-solutions/php-zabbix-api:2.2.*@dev'
composer require 'confirm-it-solutions/php-zabbix-api:2.4.*@dev'

```

Using the thing
---------------

[](#using-the-thing)

### Naming concept

[](#naming-concept)

To translate a Zabbix™ API call into a PHP method call, you can simply

1. remove the dot
2. capitalize the first letter of the action

Example:

```
Zabbix™ API         PHP API
-----------         -------
graph.get           graphGet()
host.massUpdate     hostMassUpdate()
dcheck.isWritable   dcheckIsWritable()

```

### Customizing the API class

[](#customizing-the-api-class)

By default there are only 2 classes defined:

```
ZabbixApiAbstract
└── ZabbixApi

```

If you want to customize or extend the library, you might want to do that in the `ZabbixApi` class. Out of the box, `ZabbixApi` is an empty class inherited from `ZabbixApiAbstract`.

By customizing only `ZabbixApi`, you're able to update `ZabbixApiAbstract` (the build) at any time, without merging your customizations manually.

### Basic usage

[](#basic-usage)

To use the PhpZabbixApi you just have to load `ZabbixApi.class.php`, create a new `ZabbixApi` instance, and you're ready to go:

```
