Search by

travelbrisk / connect-laravel

rabytebuildmhstackdevelop

Laravel client for the TravelBrisk Connect API

Package info

github.com/mhstackdevelop/travelbrisk

Homepage

Issues

pkg:composer/travelbrisk/connect-laravel

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-12-03 04:06 UTC

This package is auto-updated.

Last update: 2026-12-03 04:11:21 UTC


README

A Laravel-compatible Composer client for the TravelBrisk Connect API. It provides a convenience method for every endpoint in openapi.yaml, handles client-credentials access tokens, and returns Laravel HTTP Response objects.

Installation

composer require travelbrisk/connect-laravel
php artisan vendor:publish --tag=travelbrisk-config

Laravel discovers the service provider and facade automatically. Add these values to .env:

TRAVELBRISK_CLIENT_ID=your-client-id
TRAVELBRISK_CLIENT_SECRET=your-client-secret
# Production:
TRAVELBRISK_BASE_URL=https://prod.api.travelbrisk.com
# Certification/sandbox:
# TRAVELBRISK_BASE_URL=https://cert.api.travelbrisk.com
TRAVELBRISK_TIMEOUT=30

Alternatively, if you already have a bearer token, configure it directly and omit both OAuth client credentials:

TRAVELBRISK_BASE_URL=https://prod.api.travelbrisk.com
TRAVELBRISK_BEARER_TOKEN=your-bearer-token
TRAVELBRISK_TIMEOUT=30

Direct-bearer mode sends Authorization: Bearer ... on authenticated requests and does not call /oauth/token. It does not change public reference-data endpoints.

Never commit API credentials. Sandbox credentials use the certification URL; use the production URL only with live credentials.

Usage

Resolve the client through Laravel's container:

use TravelBrisk\Connect\ConnectClient;

$client = app(ConnectClient::class);

$response = $client->searchFlights([
    'origin' => 'LOS',
    'destination' => 'LHR',
    'departure_date' => '2026-08-10',
    'adults' => 1,
]);

$results = $client->getFlightSearchResults([
    'search_id' => $response->json('SessionId'),
]);

Or use the facade:

use TravelBrisk\Connect\Facades\TravelBriskConnect;

$response = TravelBriskConnect::searchHotelCities(['search' => 'London']);

Authenticated requests acquire and reuse the access token until shortly before it expires. Public reference-data methods (searchAirports, searchAirportsByCity, listAirlines, and listCountries) do not attach a token. API error responses are returned unchanged; use Laravel's $response->throw() when you want HTTP errors to raise exceptions. The authenticate() method can be called explicitly and returns the token response.

Booking methods accept an optional headers array, allowing callers to pass headers such as Idempotency-Key when supported by the endpoint:

$response = $client->createHotelBooking($payload, [
    'Idempotency-Key' => $bookingAttemptId,
]);

The client does not retry requests automatically because retries on booking operations must be managed deliberately using the API's idempotency behavior. Booking does not settle payment: issue flight tickets with issueFlightTicket after settlement, or finalize hotel reservations with confirmHotelBooking.

Webhook signatures

Webhook signature verification is performed by your application's incoming webhook route, not by this outbound API client. Verify the raw request body with the endpoint signing secret and constant-time comparison:

$expected = hash_hmac('sha256', $request->getContent(), $signingSecret);
$signature = $request->header('X-TravelBrisk-Signature', '');

abort_unless(hash_equals($expected, $signature), 401);

Use the delivery id as an idempotency key because webhook retries reuse it.

Services

ConnectClient includes methods for authentication, flight search/booking, hotel search/booking, logs, the wholesale purse, airports, airlines, and countries. The client exposes descriptive camelCase methods for the OpenAPI operations; request bodies and query parameters are passed as arrays. See openapi.yaml for endpoint payloads, required scopes, and booking flow details.