PHP

Warning! This page documents an old version of InfluxDB, which is no longer actively developed. InfluxDB v1.2 is the most recent stable version of InfluxDB.

There’s a PHP InfluxDB library on GitHub thanks to C├ęsar D. Rodas.

Installation (using composer)

composer require crodas/influx-php:\*

Usage

<?php

$client = new \crodas\InfluxPHP\Client(
    "localhost", // host
    8086,        // port
    "root",      // user
    "root"       // password
);

Creating a Database

<?php

$db = $client->createDatabase("foobar");
$db->createUser("user", "pass");

Inserting Data

<?php

$db = $client->foobar;
$db->insert("some label", ['foobar' => 'bar']);

Querying

<?php

$db = $client->foobar;

foreach ($db->query("SELECT * FROM foo;") as $row) {
    var_dump($row, $row->time);
}

Be a fantastic human and contribute to these docs.