yourtransfer24/yt24-sdk-php 问题修复 & 功能扩展

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

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

yourtransfer24/yt24-sdk-php

最新稳定版本:1.0.0

Composer 安装命令:

composer require yourtransfer24/yt24-sdk-php

包简介

Official PHP SDK for the YourTransfer24 REST JSON API Platform.

README 文档

README

Official PHP SDK for the YourTransfer24 REST JSON API Platform. Provides clean access to authentication, profile data, bookings, booking confirmation, booking status, availability checks, quotes, vehicles, companies, coverage, and logs. Fully aligned with the official YourTransfer24 API documentation.

Installation

composer require yourtransfer24/yt24-sdk-php

Initialization


use YT24SDK\YT24Client;
use YT24SDK\ProfileAPI;
use YT24SDK\BookingsAPI;
use YT24SDK\AvailabilityAPI;
use YT24SDK\QuoteAPI;
use YT24SDK\VehiclesAPI;
use YT24SDK\CompaniesAPI;
use YT24SDK\CoverageAPI;
use YT24SDK\LogsAPI;

$client = new YT24Client("YOUR_API_KEY", "sandbox");

// Instantiate endpoints
$profile = new ProfileAPI($client);
$bookings = new BookingsAPI($client);
$availability = new AvailabilityAPI($client);
$quote = new QuoteAPI($client);
$vehicles = new VehiclesAPI($client);
$companies = new CompaniesAPI($client);
$coverage = new CoverageAPI($client);
$logs = new LogsAPI($client);

API Usage

1. Profile


// Get profile
$data = $profile->getProfile();

// Update profile
$profile->updateProfile([
    "first_name" => "John",
    "last_name" => "Doe"
]);

2. Bookings

Create, Retrieve, List, Confirm, Update Status


// List bookings
$bookings->list();

// With filters
$bookings->list(["limit" => 20, "page" => 2]);

// Retrieve a booking
$bookings->get(123);

// Create booking (Full Real Payload Example)
$bookings->create([
    "pickup_location" => "Airport",
    "dropoff_location" => "Hotel",
    "date" => "2025-01-20",
    "passengers" => 3,
    "luggage" => 2,
    "vehicle_type" => "Sedan",
    "flight_number" => "AA123",
    "arrival_time" => "14:30",
    "child_seats" => 1,
    "notes" => "Customer prefers front seat",
    "customer" => [
        "first_name" => "John",
        "last_name" => "Doe",
        "email" => "john@example.com",
        "phone" => "+18095551234"
    ]
]);

// Confirm a booking
$bookings->confirm(123);

// Update booking status
$bookings->updateStatus(123, ["status" => "confirmed"]);

3. Availability


$availability->check([
    "pickup_location" => "Airport",
    "dropoff_location" => "Hotel",
    "date" => "2025-01-20"
]);

4. Quote


$quote->getQuote([
    "pickup_location" => "Airport",
    "dropoff_location" => "Hotel",
    "passengers" => 2
]);

5. Vehicles


// List vehicles
$vehicles->list();

// Vehicle details
$vehicles->get(5);

6. Companies


// Company list
$companies->list();

// Company details
$companies->get(12);

7. Coverage


// Get operating zones and coverage areas
$coverage->list();

8. Logs


// Logs filtering example
$logs->list(["booking_id" => 123]);

Error Handling

YourTransfer24 API returns strict structured JSON errors:

{
  "error": true,
  "type": "validation_error",
  "message": "Pickup location is required",
  "err_key": "YT24_400_01"
}

Capturing Errors


try {
    $bookings->create([]);
} catch (Exception $err) {
    echo $err->status;   // HTTP status code
    echo $err->err_key;  // API error code
    echo $err->getMessage(); // Error message
}

The SDK does not modify, alter, wrap, or transform errors — they are returned exactly as provided by the YourTransfer24 API.

Project Structure


yt24-sdk-php/
│── README.md
│── LICENSE
│── composer.json
└── src/
    ├── YT24Client.php
    ├── ProfileAPI.php
    ├── BookingsAPI.php
    ├── AvailabilityAPI.php
    ├── QuoteAPI.php
    ├── VehiclesAPI.php
    ├── CompaniesAPI.php
    ├── CoverageAPI.php
    ├── LogsAPI.php

License

MIT License © YourTransfer24

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固