get-impala / impala-php
PHP wrapper for Impala hotel PMS API
Installs: 2 346
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 4
Forks: 2
Open Issues: 0
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^6.3
- nesbot/carbon: ^1.22
Requires (Dev)
- phpunit/php-code-coverage: ^5.3.0
- phpunit/phpunit: ^6
This package is not auto-updated.
Last update: 2021-08-19 15:46:40 UTC
README
Installation
It's as simple as:
$ composer require get-impala/impala-php
Tests
To run the tests you can run the following command:
$ ./vendor/bin/phpunit
Obtaining an API key
To use this library, you will need an Impala API key. More information can be found in the 'Getting Started' section of the Impala developer documentation.
Getting Started
After installation, you can instantiate the library using its factory class:
require_once __DIR__ . '/vendor/autoload.php'; use Impala\ImpalaFactory; $impala = ImpalaFactory::create(<api-key>);
Working with a single hotel
If your application will only be dealing with a single hotel at a time, you can instantiate the Impala API like this:
$hapiHotel = ImpalaFactory::create('secret', 'hapi');
Working with multiple hotels
If your application will be dealing with multiple hotels, you can omit the hotelId
parameter, like so:
$impala = ImpalaFactory::create('secret'); // You can then pass the hotelId directly to the method $impala->getBookings(['hotelId' => 'hapi']); // Or with extra parameters $impala->getBookings([ 'hotelId' => 'hapi', 'startDate' => '2018-02-03', 'endDate' => '2018-02-05', ]); // Or, you can call getHotel to return a single-hotel API instance $hapiHotel = $impala->getHotel('hapi') // You can then call the API methods like normal $hapiHotel->getBookings();
Making API calls
API methods accept an associative array as their first argument, containing the parameters for the API call. This can be omitted if there are no arguments to set.
API methods that take an ID have the ID as the first argument.
API methods that update a resource take the array representation of a JSON merge patch as their second argument.
For example:
use Impala\ImpalaFactory; $hapiHotel = ImpalaFactory::create('secret', 'hapi') $hapiHotel->getBookings([ 'startDate' => '2018-02-03', 'endDate' => '2018-02-05', ]); $hapiHotel->getBookingById('c4be6570-15fc-4926-b339-446db4800f81');