PHP code example of pdffiller / laravel-influx-provider

1. Go to this page and download the library: Download pdffiller/laravel-influx-provider 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/ */

    

pdffiller / laravel-influx-provider example snippets


'providers' => [
//  ...
    Pdffiller\LaravelInfluxProvider\InfluxDBServiceProvider::class,
]


'aliases' => [
// ...
    'Influx' => Pdffiller\LaravelInfluxProvider\InfluxDBFacade::class,
]


$client = new \Influx;
$data   = $client::query('SELECT * from "data" ORDER BY time DESC LIMIT 1');

$point = [
    new \InfluxDB\Point(
        'name' => 'some_name',
        'value' => 1, // some value for some_name
        'tags' => [
            // array of string values
        ],
        'fields' => [
            // array of numeric values
        ],
        'timestamp' => exec('date +%s%N')  // timestamp in nanoseconds on Linux ONLY
    )
];
try {
    Influx::writePoints($point);
} catch (\InfluxDB\Exception $e) {
    // something is wrong, track this
}

Influx::selectDB($dbName)->writePoints($point);