Skip to content

Commit 39ad9f6

Browse files
committed
Clarify setup instructions, merge to include newer examples
1 parent e14ded4 commit 39ad9f6

File tree

3 files changed

+106
-59
lines changed

3 files changed

+106
-59
lines changed

README.md

Lines changed: 102 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
1+
[![Build Status](https://travis-ci.org/htmlgraphic/Checkfront-PHP-SDK.svg?branch=develop)](https://travis-ci.org/htmlgraphic/Checkfront-PHP-SDK)
2+
13
Checkfront PHP SDK (v3.0)
24
==========================
35

4-
The [Checkfront Booking API](http://www.checkfront.com/developers/api/) allows you
5-
to build integrations and custom applications that interact with a remote Checkfront account.
6+
The [Checkfront Booking API](http://www.checkfront.com/developers/api/) allows you to build integrations and custom applications that interact with a remote Checkfront account.
67

7-
This repository contains the open source PHP SDK that allows you to utilize the
8-
above on your website. Except as otherwise noted, the Checkfront PHP SDK
9-
is licensed under the Apache Licence, Version 2.0
8+
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
109
(http://www.apache.org/licenses/LICENSE-2.0.html)
1110

12-
Updates
13-
-------
14-
15-
* The 'Cart' example has been given a few quick fixes for v3 API support, using token pair auth.
16-
* The CheckfrontAPI library now supports connecting to the v3 API, as well as features like token pair authentication
17-
* New/updated examples are in the works.
18-
* See our v3 API documentation for more information.
1911

2012

21-
Features
22-
--------
13+
## Features
14+
---
2315

2416
The Checkfront API SDK provides the following functionality:
2517

@@ -28,49 +20,126 @@ The Checkfront API SDK provides the following functionality:
2820
* Token pair authorization.
2921
* Session handing.
3022
* Access to Checkfront Objects via GET, POST, PUT and DELETE request.
23+
* Notifications via API Hook
24+
* Installation via PHP Composer
25+
26+
27+
## Installation & Usage
28+
---
29+
30+
This repo is setup to extend off of the library created by Checkfront. To update this library, a Composer.json file has been created.
3131

32-
Usage
33-
-----
32+
If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application.
3433

35-
The examples are a good place to start. The minimal you'll need to
36-
have is:
34+
## Quick Start
35+
36+
Let's install Checkfront-PHP-DK via the following few commands:
37+
38+
> Type `composer` for more options:
39+
40+
```
41+
$ composer init --require="checkfront/checkfront:3.0.*" -n
42+
$ composer install
43+
```
44+
45+
46+
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. Obtain API credintials [https://{your-company}.checkfront.com/manage/developer/](https://{your-company}.checkfront.com/manage/developer/)
47+
48+
```bash
49+
require 'vendor/autoload.php';
50+
```
51+
52+
> The repo example files are a good place to start.
53+
54+
```shell
55+
PHP-SDK # → Root of Service
56+
└── examples/
57+
└── cart
58+
├── Cart.php # → Main wrapper class, ADD API KEY
59+
├── create.php # → Process $_POST request, add to cart session
60+
├── Form.php # → Various PHP functions
61+
├── index.php # → Default view, list avaiable inventory
62+
└── README.md # → File overview
63+
```
3764

38-
##### OAuth2 Access
65+
#### OAuth2 Access
3966

4067
```php
41-
<?
68+
<?php
4269
$Checkfront = new Checkfront(
4370
array(
44-
'host'=>'your-company.checkfront.com',
45-
'consumer_key' => '5010076404ec1809470508',
71+
'host' => 'your-company.checkfront.com',
72+
'consumer_key' => '5010076404ec1809470508',
4673
'consumer_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
47-
'redirect_uri'=>'oob',
48-
)
49-
);
74+
'redirect_uri' => 'oob',
75+
));
5076
?>
5177
```
5278

53-
##### Token Access
79+
#### Token Access
5480

5581
```php
56-
<?
82+
<?php
5783
$Checkfront = new Checkfront(
5884
array(
5985
'host'=>'your-company.checkfront.com',
60-
'auth_type' => 'token',
86+
'auth_type' => 'token',
6187
'api_key' => '5010076404ec1809470508',
6288
'api_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
63-
)
64-
);
89+
));
6590
?>
6691
```
6792

93+
### PHP Examples
6894
```php
69-
<?
70-
/* Get items rates and availbility*/
71-
$Checkfront->get('item',array(
95+
<?php
96+
// Get items rates and availbility
97+
$items = $Checkfront->get('item',array(
7298
'start_date'=>date('Y-m-d'),
7399
'end_date'=>date('Y-m-d',strtotime('+3 days'))
74100
));
101+
102+
print_r( $items );
103+
104+
// fetch all bookings
105+
public function query_booking()
106+
{
107+
$response = $this->Checkfront->get('booking/index');
108+
return $response;
109+
}
110+
111+
print_r(query_booking() );
75112
?>
76113
```
114+
115+
---
116+
117+
Notifications via Checkfront API
118+
===
119+
Send reminders to guests as they arrive with details and directions. Send a thank you message when they jet home.
120+
121+
## Overview
122+
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.
123+
124+
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.
125+
126+
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.
127+
128+
129+
## Usage
130+
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.
131+
132+
133+
134+
### Notification Service Breakdown
135+
136+
```shell
137+
PHP-SDK # → Root of Service
138+
└── scripts/
139+
└── notifications
140+
├── includes
141+
│ ├── db.class.php # → DB Interface Class
142+
│ └── notifications.class.php # → Parse of incoming data
143+
├── notifications-example.php # → Processing Example file
144+
└── notifications.sql # → DB Example File
145+
```

examples/cart/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Sample Booking Cart
1+
Sample Reservation System
22
==========================
33

44
The Booking Cart demo is a bare bones shopping card style booking page. It is not intended
@@ -14,8 +14,10 @@ allows you to add multiple items to your session.
1414

1515
API calls:
1616

17+
```
1718
booking/session
1819
item
20+
```
1921

2022
create.php
2123
----------
@@ -43,4 +45,4 @@ The form class is an optional helper class that renders the form fields into htm
4345
Cart.php
4446
--------
4547

46-
Main wrapper class that encapsulates the Checkfront API and extends some custom calls.
48+
Main wrapper class that encapsulates the Checkfront API and extends some custom calls. Add API Key & API Secret to this file.

scripts/notifications/README.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)