PHPackages                             corley/influxdb-sdk - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. corley/influxdb-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

corley/influxdb-sdk
===================

Send your app metrics to InfluxDB

1.0.0(8y ago)84296.5k↑475%24[3 PRs](https://github.com/corley/influxdb-php-sdk/pulls)2MITPHPPHP &gt;=5.5CI failing

Since Sep 10Pushed 6y ago9 watchersCompare

[ Source](https://github.com/corley/influxdb-php-sdk)[ Packagist](https://packagist.org/packages/corley/influxdb-sdk)[ Docs](http://www.corley.it/)[ RSS](/packages/corley-influxdb-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (43)Used By (2)

InfluxDB PHP SDK
================

[](#influxdb-php-sdk)

[![Build Status](https://camo.githubusercontent.com/a72fe19f1f2dc86dcee0fafcacf50a45c898882fa4875e25c0ae8b1a1f092161/68747470733a2f2f7472617669732d63692e6f72672f636f726c65792f696e666c757864622d7068702d73646b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/corley/influxdb-php-sdk)[![Code Coverage](https://camo.githubusercontent.com/05d32f2b831fd85e597c78719aa9ef4438bab06e62135a3ae05fb91502d981e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f726c65792f696e666c757864622d7068702d73646b2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/corley/influxdb-php-sdk/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f0e69a1ccc8c7a400c7e914d6d74ee7edaefb9e1eb472d0dc2f956d13ccfa988/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f726c65792f696e666c757864622d7068702d73646b2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/corley/influxdb-php-sdk/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/73121325b4d3d130ed0edbf3ad5eeb3c1009d23747872dc19d801faa89cb4358/68747470733a2f2f706f7365722e707567782e6f72672f636f726c65792f696e666c757864622d73646b2f762f737461626c65)](https://packagist.org/packages/corley/influxdb-sdk)[![License](https://camo.githubusercontent.com/a77e1f2ec022ddc1121c3ee1675a7f4c732c2b1e38c26f33388440bafc9403c8/68747470733a2f2f706f7365722e707567782e6f72672f636f726c65792f696e666c757864622d73646b2f6c6963656e7365)](https://packagist.org/packages/corley/influxdb-sdk)

Send metrics to InfluxDB and query for any data.

This project support InfluxDB API `>= 0.9` - **For InfluxDB v0.8 checkout branch 0.3 (no longer supported)**

Supported adapters:

- UDP/IP
- HTTP (via GuzzleHTTP versions: ~5, ~6) - **For Guzzle 4 support checkout branch 0.9 (no longer supported)**

Install it
----------

[](#install-it)

Just use composer

```
$ composer require corley/influxdb-sdk:~1
```

Or add to your `composer.json` file

```
{
  "require": {
    "corley/influxdb-sdk": "~1"
  }
}
```

Use it
------

[](#use-it)

Add new points:

```
$client->mark("app-search", [
    "key" => "this is my search"
]);
```

Or use InfluxDB direct messages

```
$client->mark([
    "tags" => [
        "dc" => "eu-west-1",
    ],
    "points" => [
        [
            "measurement" => "instance",
            "fields" => [
                "cpu" => 18.12,
                "free" => 712423,
            ],
        ],
    ]
]);
```

Retrieve existing points:

```
$results = $client->query('select * from "app-search"');
```

InfluxDB client adapters
------------------------

[](#influxdb-client-adapters)

Actually we supports two network adapters

- UDP/IP - in order to send data via UDP/IP (datagram)
- HTTP - in order to send/retrieve using HTTP messages (connection oriented)

### Using UDP/IP Adapter

[](#using-udpip-adapter)

In order to use the UDP/IP adapter your must have PHP compiled with the `sockets` extension.

**Usage**

```
$reader = ...

$options = new Udp\Options();
$writer = new Udp\Writer($options);

$client = new Client($reader, $writer);
```

*UDP/IP option set have only `host` and `port` properties you configure database and retention policies directly in your InfluxDB configuration*

### Using HTTP Adapters

[](#using-http-adapters)

Actually Guzzle is used as HTTP client library

```
