craymend / tokeet-sdk
Php SDK for Tokeet Client API
dev-master
2021-04-22 16:32 UTC
Requires
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2024-10-23 21:28:37 UTC
README
Query Tokeet API for Rentals and Tokeet Data Feeds for additional information including current bookings.
Installation
Via composer.
composer require craymend/tokeet-sdk
Run
artisan vendor:publish
Now in your .env file, define your Tokeet credentials:
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>
Rental API Usage Example
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"; } }
Data Feed Booking Example
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"; } }
License
The MIT License (MIT). Please see License File for more information.