, (*1)
Checkfront PHP SDK (v1.3)
The Checkfront API 3.0 allows you to build integrations and custom applications that interact with a remote Checkfront account., (*2)
This repository contains the open source PHP SDK and various example scripts. Except as otherwise noted, the Checkfront PHP SDK is licensed under the Apache Licence, Version 2.0
(http://www.apache.org/licenses/LICENSE-2.0.html), (*3)
Features
The Checkfront API SDK (v1.3) provides the following functionality:, (*4)
- OAuth2 authorization and authentication.
- OAuth2 token refresh.
- Token pair authorization.
- Session handing.
- Access to Checkfront Objects via GET, POST, PUT and DELETE request.
- Notifications via API Hook
- Installation via PHP Composer
Installation & Usage
This repo is setup to extend off of the library created by Checkfront. To update this library, a Composer.json file has been created., (*5)
If you are not using Composer, you should be. It's an excellent way to manage dependencies in your PHP application., (*6)
Quick Start
Let's install Checkfront-PHP-DK via the following few commands:, (*7)
Type composer
for more options:, (*8)
$ composer init --require="checkfront/checkfront:1.3" -n
$ composer install
require 'vendor/autoload.php';
Now the needed code should be available within your project. At the top of your PHP script require the autoloader, if you are using a MVC such as CodeIgnitor or Laravel review their autoload guides., (*9)
API credintials: https://{your-company}.checkfront.com/manage/developer/, (*10)
The repo example files are a good place to start., (*11)
PHP-SDK # β Root of Service
βββ examples/
βββ cart
βββ Cart.php # β Main wrapper class, ADD API KEY
βββ create.php # β Process $_POST request, add to cart session
βββ Form.php # β Various PHP functions
βββ index.php # β Default view, list available inventory
βββ README.md # β File overview & tips
OAuth2 Access
<?php
$Checkfront = new Checkfront(
array(
'host' => 'your-company.checkfront.com',
'consumer_key' => '5010076404ec1809470508',
'consumer_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
'redirect_uri' => 'oob',
));
?>
Token Access
<?php
$Checkfront = new Checkfront(
array(
'host' => 'your-company.checkfront.com',
'auth_type' => 'token',
'api_key' => '5010076404ec1809470508',
'api_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
));
?>
PHP Examples
get('item', array(
'start_date'=>date('Y-m-d'),
'end_date'=>date('Y-m-d',strtotime('+3 days'))
));
print_r( $items );
// Fetch all bookings
public function query_booking()
{
$response = $this->Checkfront->get('booking/index');
return $response;
}
print_r(query_booking() );
?>
Notifications via Checkfront API
Send reminders to guests as they arrive with details and directions. Send a follow-up thank you message as your guests jet home., (*12)
Overview
Traveling to new areas requires planning for the unexpected and help from trusted travel partners. Have tips and maps sent to your guests a day before they arrive via email or text message., (*13)
There might be a need to send out more targeted emails with your reservations and this can be done. By using the event notification service from Checkfront a notification can be sent to a server with information about the reservation. Using Notification Service a custom template can be used to inform guests., (*14)
An additional example. Letβs say you have 5 properties and they spread around the city. The guest booked a reservation at 123 ABC Street and after booking a rental car they are on their way. They indicated their approximate arrival time. You could have a text message or email informing the guest of arrival instructions as they indicated their check-in time via the booking., (*15)
Usage
Move the following example file notifications-example.php
to a place of your choosing and include update the path(s) to the class files needed to process this script., (*16)
Notification Service Breakdown
PHP-SDK # β Root of Service
βββ scripts/
βββ notifications
βββ includes
β βββ db.class.php # β DB Interface Class
β βββ notifications.class.php # β Parse of incoming data
βββ notifications-example.php # β Processing Example file
βββ notifications.sql # β DB Example File
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
)
- Make your changes
- Run the tests, adding new ones for your own code if necessary (
phpunit
)
- Commit your changes (
git commit -am 'Added some feature'
)
- Push to the branch (
git push origin my-new-feature
)
- Create new Pull Request