cryptoweb / infoflot-api
PHP Client for Infoflot REST API
0.1.3
2024-07-06 11:00 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^6.0 | ^7.0
README
Warning
This package is at an early stage of development!
Description
Note
Basic documentation: https://restapi.infoflot.com/docs
Installation
composer require cryptoweb/infoflot-api
Integration
We have package for simple integration with Laravel: cryptoweb/infoflot-laravel
Usage
client initialization
require 'vendor/autoload.php'; use CryptoWeb\InfoflotApi\Client; use CryptoWeb\InfoflotApi\ClientOptions; $client = new Client( new GuzzleHttp\Client(), new ClientOptions( apiKey: 'your-api-key', ) );
factory
use CryptoWeb\InfoflotApi\Enums\ShipTypeAsOnMainSiteEnum; use CryptoWeb\InfoflotApi\Factory; $infoflot = new Factory($client); $infoflot->cruises() ->type(ShipTypeAsOnMainSiteEnum::TURKISH_RIVERA) ->nights(5) ->get(); $infoflot->cruises(100500) ->get(); $infoflot->cruises(100500) ->cabins() ->get(); $infoflot->cruises(100500) ->cabins() ->search() ->get(); // etc...
builders
use CryptoWeb\InfoflotApi\Builders\Cruises; use CryptoWeb\InfoflotApi\Builders\CruisesId; use CryptoWeb\InfoflotApi\Builders\CruisesIdCabins; use CryptoWeb\InfoflotApi\Builders\CruisesIdCabinsSearch; use CryptoWeb\InfoflotApi\Enums\CruiseTypeEnum; // get all cruises $cruisesBuilder = new Cruises($client); $cruisesBuilder->type(CruiseTypeEnum::RIVER) $cruisesBuilder->nights(5); $cruisesResult = $cruisesBuilder->get(); // or $cruisesResult = (new Cruises($client)) ->type(CruiseTypeEnum::SEA) ->nights(5, 6, 7) ->get(); // get cruise by id $cruiseBuilder = new CitiesId($client); $cruiseBuilder->id(311); $cruiseResult = $cruiseBuilder->get(); // get cruise cabins by id $cruiseCabinsResult = (new CruisesIdCabins($client)) ->id(311) ->get(); // etc...
usage basic
$result = $client->request('cruises', [ 'ship' => '311,312,400', 'type' => 'sea' ]);
License
The MIT License (MIT). Please see LICENSE for more information.