hellojb/foxess-php 问题修复 & 功能扩展

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

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

hellojb/foxess-php

Composer 安装命令:

composer require hellojb/foxess-php

包简介

PHP SDK for the FoxESS Cloud API with Laravel support

README 文档

README

PHP SDK for the FoxESS Cloud Open API with Laravel support.

Features

  • OAuth 2.0 Authorization Code Grant authentication
  • Automatic token refresh
  • Real-time device data (battery SOC, solar generation, grid import/export, load statistics)
  • Batch queries for multiple devices
  • Typed DTOs with helper methods
  • Laravel Service Provider, Facade, and config
  • Rate limit exception handling

Requirements

  • PHP 8.2+
  • GuzzleHTTP 7.0+

Installation

composer require hellojb/foxess-php

Standalone Usage

use Hellojb\Foxess\FoxEss;
use Hellojb\Foxess\Auth\AccessToken;

$token = new AccessToken('your-access-token');

$client = new FoxEss([
    'base_url' => 'https://www.foxesscloud.com/',
    'token' => $token,
]);

$realTime = $client->realTimeData()->query(['YOUR_DEVICE_SN']);

foreach ($realTime as $data) {
    echo "SoC: {$data->soc()}%\n";
    echo "PV Power: {$data->pvPower()} kW\n";
    echo "Charging: " . ($data->isCharging() ? 'Yes' : 'No') . "\n";
}

Laravel Usage

Publish the config:

php artisan vendor:publish --tag=foxess-config

Set .env variables:

FOXESS_CLIENT_ID=your-client-id
FOXESS_CLIENT_SECRET=your-client-secret
FOXESS_REDIRECT_URI=https://your-app.com/auth/foxess/callback

Use the Facade:

use Hellojb\Foxess\Laravel\FoxEssFacade as FoxEss;

$realTime = FoxEss::realTimeData()->query(['SN001']);

Real-Time Data Helpers

The RealTimeData DTO provides convenient accessors:

Method Description
soc() Battery state of charge (%)
pvPower() Solar generation (kW)
loadsPower() Home load (kW)
batteryPower() Battery power (negative = charging, positive = discharging)
isCharging() Is battery currently charging?
isDischarging() Is battery currently discharging?
isImporting() Is power being imported from grid?
isExporting() Is power being exported to grid?

License

MIT

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固