byd / api-client
PHP client for BYD vehicle API
dev-main
2026-03-09 04:18 UTC
Requires
- php: ^8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- psr/log: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2026-03-09 04:20:38 UTC
README
PHP client library for the BYD vehicle API.
Features
- Authentication
- Vehicle listing
- Real-time data
- GPS information
- HVAC status
- Charging status
- Energy consumption
- Remote control
- Smart charging
- Push notifications
- Vehicle settings
Installation
composer require byd/api-client
Usage
<?php require_once 'vendor/autoload.php'; use Byd\ApiClient\Client; use Byd\ApiClient\Config\BydConfig; // Create configuration $config = BydConfig::fromEnv([ 'username' => 'your-email@example.com', 'password' => 'your-password', // ... other options ]); // Create client $client = new Client($config); // Login $client->login(); // Get vehicles $vehicles = $client->getVehicles(); foreach ($vehicles as $vehicle) { echo "VIN: " . $vehicle->getVin() . "\n"; echo "Model: " . $vehicle->getModelName() . "\n"; echo "---\n"; }
Configuration
The client can be configured in several ways:
Environment Variables
BYD_USERNAME=your-email@example.com BYD_PASSWORD=your-password BYD_BASE_URL=https://dilinkappoversea-eu.byd.auto BYD_COUNTRY_CODE=NL BYD_LANGUAGE=en BYD_TIME_ZONE=Europe/Amsterdam
Direct Configuration
$config = new BydConfig( 'your-email@example.com', 'your-password', 'https://dilinkappoversea-eu.byd.auto', // base URL 'NL', // country code 'en', // language 'Europe/Amsterdam', // time zone // ... other options );
API Documentation
Key classes and methods:
Client- Main client classBydConfig- Configuration classVehicle- Vehicle modelVehicleApi- Vehicle-related API methodsRealtimeApi- Real-time data API methodsGpsApi- GPS information API methodsHvacApi- HVAC status API methodsChargingApi- Charging status API methodsEnergyApi- Energy consumption API methodsControlApi- Remote control API methodsSmartChargingApi- Smart charging API methodsPushNotificationsApi- Push notifications API methodsVehicleSettingsApi- Vehicle settings API methods
Requirements
- PHP 8.1+
- ext-json
- guzzlehttp/guzzle ^7.0
- psr/log ^3.0
Development
Install dependencies
composer install
Run tests
composer test
Code style
composer cs-fix
License
This project is licensed under the MIT License - see the LICENSE file for details.