firman / travel-api
Travel APIs fetch data from different providers, such as airlines, hotels, destinations, etc.
v0.1.11
2022-09-11 00:14 UTC
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.5
- symfony/cache: ^6.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.11
- pestphp/pest: ^1.22
- phpstan/phpstan: ^1.8
- symfony/dotenv: ^6.1
README
Travel APIs fetch data from different providers, such as airlines, hotels, destinations, etc. Currently, it only supports Amadeus API.
Installation
composer require firman/travel-api
Usage
Production environment
require 'vendor/autoload.php'; use Firman\TravelApi\Client; use Firman\TravelApi\Provider\Provider; $client = new Client(Provider::AMADEUS, [ 'client_id' => 'your_production_client_id', 'client_secret' => 'your_production_client_secret' ]);
Test environment
require 'vendor/autoload.php'; use Firman\TravelApi\Client; use Firman\TravelApi\Provider\Provider; $client = new Client(Provider::AMADEUS, [ 'client_id' => 'your_test_client_id', 'client_secret' => 'your_test_client_secret', 'env' => 'test' ]);
Nearest Airport API
// Find nearest airport within radius 150 km in Madrid city $response = $client->getNearestAirport(40.416775, -3.703790, 150);
Airport/City Search API
// Search airport(s) which contain keyword 'Kennedy' $response = $client->searchAirportOrCity('AIRPORT', 'Kennedy');
Flight Checkin Links API
// Find British Airways checkin links $response = $client->getFlightCheckinLinks('BA');
Airline Code Lookup API
// Search airline by code for Garuda Indonesia $response = $client->findAirlineByCode('GA'); // Search airline by code for British Airways and Garuda Indonesia $response = $client->findAirlineByCode(['BA', 'GA']);
Credits
License
This package is licensed under the MIT License.