pdffiller/laravel-influx-provider 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pdffiller/laravel-influx-provider

最新稳定版本:v1.6.6

Composer 安装命令:

composer require pdffiller/laravel-influx-provider

包简介

Service provider to set up and use InfluxDB SDK in Laravel 5

README 文档

README

A minimal service provider to set up and use InfluxDB SDK in Laravel 5

Installation

  • Add a line to the require section of composer.json and execute $ composer install
"require": {
//  ...
    "pdffiller/laravel-influx-provider": "^1.6"
}
  • Add these lines to config/app.php
'providers' => [
//  ...
    Pdffiller\LaravelInfluxProvider\InfluxDBServiceProvider::class,
]


'aliases' => [
// ...
    'Influx' => Pdffiller\LaravelInfluxProvider\InfluxDBFacade::class,
]
  • Define env variables to connect to InfluxDB
LARAVEL_INFLUX_PROVIDER_PROTOCOL=http
LARAVEL_INFLUX_PROVIDER_USER=some_user
LARAVEL_INFLUX_PROVIDER_PASSWORD=some_password
LARAVEL_INFLUX_PROVIDER_HOST=host
LARAVEL_INFLUX_PROVIDER_PORT=8086
LARAVEL_INFLUX_PROVIDER_DATABASE=database_name
LARAVEL_INFLUX_PROVIDER_VERIFY_SSL=false
LARAVEL_INFLUX_PROVIDER_TIMEOUT=0
LARAVEL_INFLUX_PROVIDER_CONNECT_TIMEOUT=0

How to use

$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
}

Also you can send data to another database like this:

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

License

airSlate and any contributors to this project each grants you a license, under its respective copyrights, to the Laravel InfluxDB provider and other content in this repository under the MIT License, see the LICENSE file for more information.

统计信息

  • 总下载量: 6.35k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 13
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-27