Download the PHP package php-client-zabbix/php-zabbix-api-updated without Composer

On this page you can find all versions of the php package php-client-zabbix/php-zabbix-api-updated. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-zabbix-api-updated

PhpZabbixApi

I'M LOOKING FOR CONTRIBUTORS, CLICK HERE FOR MORE INFORMATIONS

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

PhpZabbixApi is licensed under the MIT license.

Getting the thing

You can get PhpZabbixApi in 3 different ways:

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

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:

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

Download

Download a release 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:

For example:

Composer

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

All tagged versions can be installed, for example:

If you're looking for more "bleeding-edge" versions (e.g. for testing), then you could also use branches:

Using the thing

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:

Customizing the API class

By default there are only 2 classes defined:

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

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

The API can also work with HTTP Basic Authroization, you just have to call the constructor with additional parameters:

Examples

Simple request

Here's a simple request to fetch all defined graphs via graph.get API method:

Request with parameters

Most of the time you want to define some specific parameters. Here's an example to fetch all CPU graphs via graph.get API method:

Define default parameters

Sometimes you want to define default parameters, which will be included in each API request. You can do that by defining the parameters in an array via setDefaultParams():

Get associative / un-indexed array

By default all API responses will be returned in an indexed array.

So if you then looking for a specific named graph, you've to loop through the indexed array and compare the name attribute of each element. This can be a bit of a pain, and because of that, there's a simple way to to get an associative instead of an indexed array. You just have to define the 2nd parameter of the API method, which is the name of attribute you'd like to use as an array key.

Here's an example to fetch all graphs in an associative array, with the graph's name as array key:


All versions of php-zabbix-api-updated with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package php-client-zabbix/php-zabbix-api-updated contains the following files

Loading the files please wait ....