php-cupid / cupid
PHP SDK for cupid mapping
Requires
- php: >=5.3
- guzzlehttp/guzzle: ^7.4
This package is not auto-updated.
Last update: 2025-08-08 02:03:50 UTC
README
php-cupid/cupid
Table of Contents
Description
Performing mapping through the Cupid API is very straightforward. You'll first upload your properties inventory to be used as reference and then send a list of properties to be mapped to the API and get the results directly in the response.
Installation
Requires PHP version >=5.3.
The recommended way to install Guzzle is through Composer.
composer require php-cupid/cupid
Method
NOTE: The documentation below is up-to-date with 3.x
releases, if you are using an older version, please check how to upgrade.
uploadInventory
This function can be used to upload an inventory with a provided CSV file.
You will have to provide the inventory's name and for each column in your file, you'll need match its index with the standard field names provided below.
Let's assume you have a CSV file that looks like the following table:
HotelID | Hotel_Name | Hotel_Address | Hotel_Lat | Hotel_Lon | Country | City | ... |
---|---|---|---|---|---|---|---|
1408 | Smile Hotel | 123 main st | 5.419514 | 3.392694 | AU | Adelaid | ... |
123 | Cupid resort | 456 north av | 55.69254 | 37.3167887 | MA | Zagoura | ... |
In this case the form data would be:
- file: The csv file to be uploaded
- name: Cupid inventory
- header_id: 0
- header_name: 1
- header_address: 2
- header_city: 6
- header_country_code: 5
- header_latitude: 3
- header_longitude: 4
require "vendor/autoload.php"; $cupid = new App\Cupid(*YOUR API KEY*); $uploadInventory = $cupid->uploadInventory("my npm catalog", "./file.csv", 0, 1, 2, 3, 4, 5, 6) var_dump($uploadInventory);
listInventories
This function can be used to list the inventories uploaded to your workspace.
You can check their status and other basic info.
require "vendor/autoload.php"; $cupid = new App\Cupid(*YOUR API KEY*); $listInventories = $cupid->listInventories() var_dump($uploadInventory);
inventoryDetails
This function can be used to check the requested inventory's details.
You can use it to get the inventory status mapping_process_status_id
as outlined below. The status has to be 2 (Done) to start mapping.
Possible values for the inventory's status mapping_process_status_id
:
value | Name | Description | Action |
---|---|---|---|
-1 | Invalid | The inventory doesn't contain any valid hotels | Correct your catalog and try again. |
0 | Pending | The inventory is being uploaded | Wait, no action required. |
1 | Processing | The inventory is being processed | Wait, no action required. |
2 | Done | The process is complete | You can start mapping. |
3 | Failed | There was an error while processing | Retry and if the error persists, feel free to contact us. |
When you have an inventory with active=true
and mapping_process_status_id=2
you can use the following endpoint to perfom mapping:
require "vendor/autoload.php"; $cupid = new App\Cupid(*YOUR API KEY*); $inventoryDetails = $cupid->inventoryDetails($inventory_id) var_dump($inventoryDetails);
mapHotelList
This function allows you to send a list of properties and maps it against your active inventory. You will get the resulting mappings in the response.
Limit You can send up to 1000 properties per request.
$cupid = new App\Cupid(*YOUR API KEY*); $array = [ [ "address" => "123 main street", "country_code"=> "US", "hotel_code"=> "1256", "latitude"=> 36.18743350322336, "longitude"=> -115.15064193665704, "name"=> "hotel name" ] ]; $mapHotels = $cupid->mapHotels($array); print_r($mapHotels);