yourtransfer24/yt24-sdk-php

Official PHP SDK for the YourTransfer24 REST JSON API Platform.

Maintainers

Package info

github.com/YourTransfer24/yt24-sdk-php

Homepage

pkg:composer/yourtransfer24/yt24-sdk-php

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2025-11-18 19:48 UTC

This package is auto-updated.

Last update: 2026-03-17 10:52:57 UTC


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