amantinetti/laravel-influxdb2

A service made to provide, set up and use the library from influxdata influx client php 2 in Laravel.
10,022 1
Install
composer require amantinetti/laravel-influxdb2
Latest Version:v0.0.3
License:MIT
Last Updated:Jun 28, 2024
Links: GitHub  ·  Packagist
Maintainer: amantinetti

Laravel Influxdb2

A service made to provide, set up and use the library from influxdata influxdb-client-php in Laravel.

Installing

  • Install by composer command:
composer require amantinetti/laravel-influxdb2
  • Or add this line to require section of composer.json and execute on your terminal $ composer install
"require": {
    "amantinetti/laravel-influxdb2": "^0.0.1"
}

This package use auto-discover, if using less than version laravel 5.5 you must use below settings

  • Add this lines to yours config/app.php (Use only with Laravel version less than 5.5 )
'providers' => [
//  ...
    Amantinetti\InfluxDB\Providers\ServiceProvider::class,
]
'aliases' => [
//  ...
    'InfluxDB' => Amantinetti\InfluxDB\Facades\InfluxDB::class,
]
  • Define env variables to connect to InfluxDB
INFLUXDB_URL=http://localhost:8086
INFLUXDB_TOKEN=my-token
INFLUXDB_BUCKET=my-bucket
INFLUXDB_ORG=my-org
  • Write this into your terminal inside your project
php artisan vendor:publish

Reading Data

<?php

// executing a query will yield a resultset object
$query_api = InfluxDB::createQueryApi();

$result = $query_api->query('from(bucket:"my-bucket") |> range(start: 1970-01-01T00:00:00.000000001Z) |> last()');


Writing Data

<?php

$write_api = InfluxDB::createWriteApi();
$write_api->write('h2o,location=west value=33i 15');

License

This project is licensed under the MIT License

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

641,106,524 9,700
laravel/framework

The Laravel Framework.

593,882,149 34,959
laravel/tinker

Powerful REPL for the Laravel framework.

502,645,077 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

418,291,778 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released Laravel License
v0.0.3 ^6 || ^7 || ^8 || ^9 || ^10 MIT
0.0.2 ^6 || ^7 || ^8 MIT
0.0.1 ^6 || ^7 || ^8 MIT