PHP code example of animalyoung / laravel-influxdb
1. Go to this page and download the library: Download animalyoung/laravel-influxdb library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// executing a query will yield a resultset object
$result = InfluxDB::query('select * from test_metric LIMIT 5');
// get the points from the resultset yields an array
$points = $result->getPoints();
// create an array of points
$points = array(
new InfluxDB\Point(
'test_metric', // name of the measurement
null, // the measurement value
['host' => 'server01', 'region' => 'us-west'], // optional tags
['cpucount' => 10], // optional additional fields
time() // Time precision has to be set to seconds!
),
new InfluxDB\Point(
'test_metric', // name of the measurement
null, // the measurement value
['host' => 'server01', 'region' => 'us-west'], // optional tags
['cpucount' => 10], // optional additional fields
time() // Time precision has to be set to seconds!
)
);
$result = InfluxDB::writePoints($points, \InfluxDB\Database::PRECISION_SECONDS);
ini
php artisan vendor:publish
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.