Simple PHP client for InfluxDB
Go to file
Pablo Lopez Torres 42d2c2d1f0 fixing the TravisCI build with InfluxDB new features:
- dbs is changed to db in the latest InfluxDB when listing dbs
 - username is changed to name in the latest InfluxDB when creating
   user
 - PHPUnit_Framework_TestCase instead of phpunit_framework_testcase
 - Grouping by anything but time does not return time anymore
2014-09-04 18:28:50 +02:00
lib/InfluxPHP fixing the TravisCI build with InfluxDB new features: 2014-09-04 18:28:50 +02:00
tests fixing the TravisCI build with InfluxDB new features: 2014-09-04 18:28:50 +02:00
.travis.yml fixing the TravisCI build with InfluxDB new features: 2014-09-04 18:28:50 +02:00
composer.json first commit 2013-11-12 06:34:56 -03:00
phpunit.xml added some tiny tests 2013-11-12 14:33:37 -03:00
README.md Update README.md 2013-11-13 03:01:37 -05:00

InfluxDB Build Status

Simple PHP client for InfluxDB, an open-source, distributed, time series, events, and metrics database with no external dependencies.

How to install it

The easiest way is to install it via composer

composer require crodas/influx-php:\*

How to use it

You need to create a client object.

$client = new \crodas\InfluxPHP\Client(
   "localhost" /*default*/,
   8086 /* default */,
   "root" /* by default */,
   "root" /* by default */
);

The first time you should create an database.

$db = $client->createDatabase("foobar");
$db->createUser("foo", "bar"); // <-- create user/password

Create data is very simple.

$db = $client->foobar;
$db->insert("some label", ['foobar' => 'bar']); // single input
$db->insert("some label", [
    ['foobar' => 'bar'],
    ['foobar' => 'foo'],
]); // multiple input, this is better :-)

Now you can get the database object and start querying.

$db = $client->foobar;
// OR
$db = $client->getDatabase("foobar");

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