承接 inteliada/yandex-fleet-lib 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

inteliada/yandex-fleet-lib

Composer 安装命令:

composer require inteliada/yandex-fleet-lib

包简介

PHP library to work with Yandex Fleet API

README 文档

README

License: MIT PHP Version

A PHP library for integrating with the Yandex Fleet API.

Requirements

  • PHP >= 8.1
  • Composer
  • Guzzle HTTP Client >= 7.10 (or any PSR-18 HTTP client)
  • Active Yandex Fleet account with API credentials

Installation

composer require inteliada/yandex-fleet-sdk

Quick Start

use Inteliada\YandexFleetLib\Client;

$client = new Client([
    'client_id' => getenv('YANDEX_CLIENT_ID'),
    'api_key'   => getenv('YANDEX_API_KEY'),
    'park_id'   => getenv('YANDEX_PARK_ID'),
]);

// List drivers
$drivers = $client->contractorProfiles()->getList();

// List vehicles
$vehicles = $client->vehicles()->getList();

Configuration

Credentials

All three credentials are required. Obtain them from your Yandex Fleet account:

KeyDescription
client_idYour application's unique identifier
api_keyAPI authentication key
park_idFleet (park) identifier

Options

$client = new Client($credentials, [
    'timeout'  => 30,                               // seconds (default: 30)
    'retries'  => 3,                                // retries on 5xx / 429 / connection errors (default: 3)
    'base_uri' => 'https://fleet-api.taxi.yandex.net', // override for staging/testing
]);

PSR-18 HTTP client

Inject any PSR-18 compatible HTTP client (e.g. Symfony HttpClient):

use Symfony\Component\HttpClient\Psr18Client;

$client = new Client($credentials, [], httpClient: new Psr18Client());

Logging

Inject any PSR-3 logger (e.g. Monolog):

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$logger = new Logger('fleet');
$logger->pushHandler(new StreamHandler('php://stdout'));

$client = new Client($credentials, [], logger: $logger);

Rate limit awareness

$client->vehicles()->getList();
$remaining = $client->vehicles()->getList(); // second call
// Access headers from the last request:
$headers   = ... // see HttpClientInterface::getLastResponseHeaders()

API Reference

EndpointClient methodAvailable methods
Contractor ProfilescontractorProfiles()getList(), get(), create(), update(), createContractor(), createAutoCourierProfile(), createWalkingCourierProfile(), createSelfEmployedWalkingCourierProfile(), bindVehicle(), unbindVehicle(), getSupplyHours(), getBlockedBalance(), listApplications()
Vehiclesvehicles()getList(), get(), create(), update(), updateRentDetails(), updateRentTerms()
Ordersorders()getList(), track()
Transactionstransactions()getList(), listDriverTransactions(), listOrderTransactions(), listCategories(), create(), getStatus()
Driver Work RulesdriverWorkRules()getList()

Contractor Profiles

$cp = $client->contractorProfiles();

// List driver profiles
$cp->getList();
$cp->getList(['limit' => 50, 'offset' => 100]);

// Get a single driver profile
$cp->get('driver_profile_id');

// Create a driver/courier profile (choose one method based on type)
$cp->create(['person' => ['first_name' => 'Ivan', 'last_name' => 'Petrov']]);

$cp->createContractor([
    'contractor' => ['person' => [...], 'profile' => ['hire_date' => '2026-01-01']],
    'employment' => [...],
    'profession' => 'taxi/driver', // or 'cargo/courier/on-car', 'cargo/courier/on-truck'
]);

$cp->createAutoCourierProfile([
    'order_provider' => ['platform' => true, 'partner' => false],
    'person' => ['full_name' => [...], 'contact_info' => ['phone' => '+79991234567'], 'driver_license' => [...]],
]);

$cp->createWalkingCourierProfile([
    'full_name'    => ['first_name' => 'Ivan', 'last_name' => 'Petrov'],
    'phone'        => '+79991234567',
    'birth_date'   => '1990-01-01',
    'work_rule_id' => 'rule_id',
]);

// createSelfEmployedWalkingCourierProfile() takes the same fields as createWalkingCourierProfile()
$cp->createSelfEmployedWalkingCourierProfile([...]);

// Update a driver profile
$cp->update(['id' => 'driver_profile_id', 'person' => ['phone' => '+79991234567']]);

// Bind / unbind a vehicle
$cp->bindVehicle('car_id', 'driver_profile_id');
$cp->unbindVehicle('car_id', 'driver_profile_id');

// Get driver's online hours for a period
$cp->getSupplyHours('driver_profile_id', '2026-01-01T00:00:00+00:00', '2026-01-31T23:59:59+00:00');

// Get driver's account balance and restrictions
$cp->getBlockedBalance('contractor_id');

// List contractor applications (cursor-based pagination)
$cp->listApplications();
$cp->listApplications(['limit' => 50, 'cursor' => 'next-token']);

Vehicles

$vehicles = $client->vehicles();

// List vehicles
$vehicles->getList();
$vehicles->getList(['limit' => 50, 'offset' => 0]);

// Get a single vehicle
$vehicles->get('car_id');

// Create a vehicle
$vehicles->create(['callsign' => 'A001', 'model' => 'Toyota Camry']);

// Update a vehicle
$vehicles->update('car_id', ['callsign' => 'A002']);

// Modify rental arrangements for a vehicle
$vehicles->updateRentDetails('car_id', [
    'platform_channels_enabled' => true,
    'rent_term_id'              => 'term_id', // optional
]);

// Create or modify rental terms
$vehicles->updateRentTerms([
    'rent_term_id'        => 'term_id',
    'name'                => 'Standard',
    'schemas'             => [
        ['working_days' => 5, 'non_working_days' => 2, 'daily_amount' => '1000.0000'],
    ],
    'minimum_period_days' => 7,
    'is_buyout_possible'  => false,
]);

Orders

$orders = $client->orders();

// List orders — booked_at or ended_at is required
$orders->getList([
    'booked_at' => ['from' => '2026-01-01T00:00:00Z', 'to' => '2026-01-31T23:59:59Z'],
]);

$orders->getList([
    'ended_at' => ['from' => '2026-01-01T00:00:00Z', 'to' => '2026-01-31T23:59:59Z'],
    'limit'    => 50,
    'cursor'   => 'next-page-cursor',
]);

// Get GPS track for an order
$orders->track('order_id');

Transactions

$tx = $client->transactions();

// List park transactions (all filters optional)
$tx->getList();
$tx->getList([
    'event_at'     => ['from' => '2026-01-01T00:00:00Z', 'to' => '2026-01-31T23:59:59Z'],
    'category_ids' => ['bonus', 'penalty'],
    'limit'        => 40,
    'cursor'       => 'next-cursor-token',
]);

// List transactions for a specific driver
$tx->listDriverTransactions('driver_id', [
    'event_at' => ['from' => '2026-01-01T00:00:00Z', 'to' => '2026-01-31T23:59:59Z'],
]);

// List transactions for specific orders
$tx->listOrderTransactions(['order_id_1', 'order_id_2']);
$tx->listOrderTransactions(['order_id_1'], [
    'event_at' => ['from' => '2026-01-01T00:00:00Z', 'to' => '2026-01-31T23:59:59Z'],
]);

// List transaction categories (all filters optional)
$tx->listCategories();
$tx->listCategories(['is_enabled' => true, 'is_creatable' => true]);

// Create a transaction for a driver
$tx->create('driver_profile_id', [
    'amount'      => '500',
    'data'        => ['type' => 'bonus'],
    'description' => 'Top performer bonus',
]);

// Get transaction status
$tx->getStatus('driver_profile_id', 'transaction_id');
$tx->getStatus('driver_profile_id', 'transaction_id', 2); // specific version

Driver Work Rules

// List work rules for the park
$client->driverWorkRules()->getList();

Pagination

All list endpoints return a ListResponse with items, cursor, and total. Use paginate() to iterate all pages automatically — it yields typed DTOs:

// Iterate all vehicles as VehicleDto objects
foreach ($client->vehicles()->paginate() as $vehicle) {
    echo $vehicle->id . ' — ' . $vehicle->callsign . PHP_EOL;
}

// Iterate all orders (booked_at required)
foreach ($client->orders()->paginate(['booked_at' => ['from' => '2026-01-01T00:00:00Z', 'to' => '2026-01-31T23:59:59Z']]) as $order) {
    echo $order->id . ' ' . $order->status . PHP_EOL;
}

// Manual cursor pagination
$page = $client->transactions()->getList(['limit' => 40]);
while (!$page->isLastPage()) {
    foreach ($page->items as $item) { /* ... */ }
    $page = $client->transactions()->getList(['cursor' => $page->cursor]);
}

Error Handling

All API errors throw ApiException. It extends \Exception and adds two methods:

use Inteliada\YandexFleetLib\Exception\ApiException;

try {
    $driver = $client->contractorProfiles()->get('driver_id');
} catch (ApiException $e) {
    echo $e->getStatusCode();   // HTTP status code
    echo $e->getResponseBody(); // raw response body
    echo $e->getMessage();      // error message
}

Transient failures (5xx, 429, connection errors) are retried automatically up to the configured retries limit before an exception is thrown.

Project Structure

src/
├── Client.php
├── Endpoints/
│   ├── BaseEndpoint.php
│   ├── ContractorProfiles.php
│   ├── DriverWorkRules.php
│   ├── Orders.php
│   ├── Transactions.php
│   └── Vehicles.php
├── Exception/
│   └── ApiException.php
└── Http/
    ├── HttpClientInterface.php
    └── Request.php

Testing

composer test

Changelog

See CHANGELOG.md for release history.

License

MIT — see LICENSE.

Author

Denis Joloudov — info@inteliada.ru

This SDK is not officially affiliated with Yandex.

inteliada/yandex-fleet-lib 适用场景与选型建议

inteliada/yandex-fleet-lib 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 inteliada/yandex-fleet-lib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 inteliada/yandex-fleet-lib 我们能提供哪些服务?
定制开发 / 二次开发

基于 inteliada/yandex-fleet-lib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-09