power-data-hub/laraflux
Composer 安装命令:
composer require power-data-hub/laraflux
包简介
A service made to provide, set up and use influxphp in Laravel.
README 文档
README
Laravel Influxdb
A service made to provide, set up and use influxdb-php in Laravel 5.6
Installation
Follow this steps to use this package on your Laravel installation
1. Require it on composer
composer require power-data-hub/laraflux
The package will automatically register it's service provider.
For Laravel <= 5.4 add the provider manually
2. Load service provider (optional Laravel <= 5.4 only)
You need to update your config/app.php configuration file to register our service provider, adding this line on providers array:
PowerDataHub\Laraflux\ServiceProvider::class
'aliases' => [
// ...
'Laraflux' => PowerDataHub\Laraflux\Facades\Laraflux::class,
]
- Define
.envvariables to connect to InfluxDB
INFLUXDB_HOST=localhost INFLUXDB_PORT=8086 INFLUXDB_USER=some_user INFLUXDB_PASSWORD=some_password INFLUXDB_SSL=false INFLUXDB_VERIFYSSL=false INFLUXDB_TIMEOUT=0 INFLUXDB_DBNAME=some_database
- Write this into your terminal inside your project
php artisan vendor:publish
Reading Data
<?php // executing a query will yield a resultset object $result = Laraflux::query('select * from test_metric LIMIT 5'); // get the points from the resultset yields an array $points = $result->getPoints();
Writing Data
<?php // create an array of points $points = [ 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 = Laraflux::writePoints($points, \InfluxDB\Database::PRECISION_SECONDS);
License
This project is licensed under the MIT License
power-data-hub/laraflux 适用场景与选型建议
power-data-hub/laraflux 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 05 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 power-data-hub/laraflux 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 power-data-hub/laraflux 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-20