PHP code example of craymend / tokeet-sdk

1. Go to this page and download the library: Download craymend/tokeet-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

craymend / tokeet-sdk example snippets


TOKEET_API_KEY=<your Tokeet API key/email>
TOKEET_ACCOUNT=<your Tokeet Account ID>
TOKEET_INQUIRY_DATA_FEED_BASE_URL=<your Tokeet data feed url>

use Craymend\TokeetSdk\Api\Rentals;

$queryObj = new Rentals();
$response = $queryObj->getRentals();
if($response->status === 'success'){
    $rentals = $response->data;

    foreach($rentals as $rental){
        echo "$rental->name \n";
    }
}

use Craymend\TokeetSdk\DataFeed\Inquiries;

$queryObj = new Inquiries();
$response = $queryObj->getRentalBookings($rental->pkey, $startDate);

 if($response->status === 'success'){
    $bookingsCsvArray = $response->data;

    for($i = 0; $i < count($bookingsCsvArray); $i++){
        if($i == 0){
            continue; // ignore name row
        }

        $row = $bookingsCsvArray[$i];
        $bookingId = $row[8];
        $name = $row[0];

        echo "$bookingId - $name \n";
    }
 }