PHP SDK for OTA’s to easily integrate with the MyAllocator OTA BuildToUs API

PHP SDK for OTA’s to easily integrate with the MyAllocator OTA BuildToUs API


MyAllocator BuildToUs API PHP SDK (JSON). Online Travel Agencies (OTA’s) may use this SDK to quickly and reliably integrate with the MyAllocator BuildToUs API to enable distribution into their systems.

The MyAllocator BuildToUs API supports many OTA-inbound API’s but only one OTA-outbound API (NotifyBooking). As a result, this SDK currently only implements the OTA-inbound API’s defined in the MyAllocator BuildToUs API Documentation. You may implement the simple HTTP GET NotifyBooking API directly in your code base.

Note, this is not the PMS PHP SDK for PMS’s. The PMS PHP SDK can be found at

MyAllocator BuildToUs API Version: 201503

MyAllocator BuildToUs API Documentation & Integration Guide [TODO]

MyAllocator BuildToUs API PHP SDK Documentation []

MyAllocator []

MyAllocator Development Support [[email protected]]


PHP 5.3.2 and later.


Please see for the complete and up-to-date SDK documentation.

Composer Installation

You can install via composer. Add the following to your project’s composer.json.

    "require": {
        "myallocator/myallocator-php-sdk-ota": "1.*"

Then install via:

composer.phar install

To use the bindings, either use Composer’s autoload []:


Or manually:


Manual Installation

Grab the latest version of the SDK:

git clone

To use the bindings, add the following to a PHP script:


Getting Started

Installation and usage example with composer installation:

[email protected]:/var/www# mkdir test
[email protected]:/var/www# cd test/
[email protected]:/var/www/test# echo '{"require": {"myallocator/myallocator-php-sdk-ota": "1.*"}}' > composer.json
[email protected]:/var/www/test# composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing myallocator/myallocator-php-sdk-ota (1.0.0)
    Downloading: 100%         
Writing lock file
Generating autoload files
[email protected]:/var/www/test# cp vendor/myallocator/myallocator-php-sdk-ota/examples/Receiver/* .

Configure your host’s webserver at the desired endpoint to point to /var/www/test/MaReceiver.php. Send in a health check 🙂

[email protected]:/var/www/test# curl -v -H "Accept: application/json" -X POST -H "Content-Type: application/json" -d '{"verb":"HealthCheck", "mya_property_id":"123", "ota_property_id":"321", "shared_secret":"test"}' http://{your_ip}:{your_port}/

Installation and usage example with manual installation:

[email protected]:/var/www# mkdir -p test/lib
[email protected]:/var/www# cd test/lib/
[email protected]:/var/www/test/lib# git clone
Cloning into 'myallocator-ota-php'...
remote: Counting objects: 111, done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 111 (delta 38), reused 101 (delta 31), pack-reused 0
Receiving objects: 100% (111/111), 38.22 KiB | 0 bytes/s, done.
Resolving deltas: 100% (38/38), done.
Checking connectivity... done.
[email protected]:/var/www/test/lib# cd ..
[email protected]:/var/www/test# cp lib/myallocator-ota-php/examples/Receiver/* .

Edit require_once autoload in line 12 to:

require_once(dirname(__FILE__) . '/lib/myallocator-ota-php/src/MyAllocator.php');

Configure your host’s webserver at the desired endpoint to point to /var/www/test/MaReceiver.php. Send in a health check 🙂

[email protected]:/var/www/test# curl -v -H "Accept: application/json" -X POST -H "Content-Type: application/json" -d '{"verb":"HealthCheck", "mya_property_id":"123", "ota_property_id":"321", "shared_secret":"test"}' http://{your_ip}:{your_port}/


The default configuration file can be found at at src/MyAllocator/Config/MaConfig.php. The following is configurable:


The shared_secret will be allocated to the OTA by MyAllocator after initial registration. The shared_secret is used to authenticate the MA <-> OTA communication.


Set debugsEnabled to true in src/MyAllocator/Config/Config.php to display request and response data in the SDK interface and API transfer data formats for an API request.


This SDK is meant to be installed in the OTA’s environment to act as an inbound API receiver for MyAllocator. It is not required for BuildToUs API integration, however, if an OTA is integrating via PHP we highly recommend utilizing the SDK to minimize integration time and costs.

The SDK consists of three primary parts: the receiver, SDK library, and backend interface (to be implemented by OTA).


The receiver is located at examples/Receiver/MaReceiver.php and is the actual endpoint script that receives the request and forwards to the SDK library. It is optional for an OTA to utilize this receiver. If you have an existing framework for exposing endpoints, please feel free to continue using it and simply invoke the SDK library similar to the receiver example. If an existing mechanism is not available and you would like a quick solution, please feel free to use the included receiver.

SDK Library

The SDK library is located at src/MyAllocator and consists of the inbound API router, API definitions, backend interface definition, and required infrastructure.

Backend Interface

The SDK library includes a backend interface definition located at src/MyAllocator/Api/Inbound/MaInboundInterface.php which must be implemented by your environment so that the router (MaRouter.php) may forward requests to your backend system. You must instantiate an object of the class that implements this interface and pass it into the MaRouter object’s construct during instantiation. Take a look at examples/Receiver/MaInboundInterfaceStub.php for a stub/example interface implementation and examples/Receiver/MaReceiver.php for how it is instantiated and passed into MaRouter.

It is worth explicitly noting, the backend interface implementations must return an MaResponse object to the calling router (as suggested by the docblocks).


Examples can be found in the examples/ directory.


You can run phpunit tests from the top directory:

vendor/bin/phpunit --debug


Add a Comment

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *