|
1 | | -[](https://travis-ci.org/htmlgraphic/PHP-SDK) |
| 1 | +Checkfront PHP SDK (v3.0) |
| 2 | +========================== |
2 | 3 |
|
3 | | -# Checkfront PHP SDK (v3.0) |
| 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. |
4 | 6 |
|
5 | | -The [Checkfront API](http://api.checkfront.com/en/latest/) allows you |
6 | | -to build integrations and custom applications that interact with the Checkfront service. |
| 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 |
| 10 | +(http://www.apache.org/licenses/LICENSE-2.0.html) |
7 | 11 |
|
8 | | -##Features |
| 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. |
| 19 | + |
| 20 | + |
| 21 | +Features |
| 22 | +-------- |
9 | 23 |
|
10 | 24 | The Checkfront API SDK provides the following functionality: |
11 | 25 |
|
12 | | -* OAuth 2.0 authorization and authentication. |
13 | | -* OAuth 2.0 token refresh. |
| 26 | +* OAuth2 authorization and authentication. |
| 27 | +* OAuth2 token refresh. |
14 | 28 | * Token pair authorization. |
15 | 29 | * Session handing. |
16 | 30 | * Access to Checkfront Objects via GET, POST, PUT and DELETE request. |
17 | 31 |
|
| 32 | +Usage |
| 33 | +----- |
18 | 34 |
|
19 | | -## Installation |
20 | | - |
21 | | -This repo is setup to extend off of the library created by Checkfront. To easily add or **update** this library, a Composer.json file has been created. |
22 | | - |
23 | | -If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application. Offically Checkfront does not have a registered Composer library, no problem it can be setup via the following code: |
24 | | - |
25 | | -Setup composer with the needed code: |
26 | | - |
27 | | -``` |
28 | | -$ composer init --require="checkfront/checkfront:3.0.*" -n |
29 | | -$ composer install |
30 | | -``` |
31 | | -Now the needed code should be available within your project. |
32 | | - |
| 35 | +The examples are a good place to start. The minimal you'll need to |
| 36 | +have is: |
33 | 37 |
|
34 | | -Next, at the top of your PHP script require the autoloader: |
| 38 | +##### OAuth2 Access |
35 | 39 |
|
36 | | -```bash |
37 | | -require 'vendor/autoload.php'; |
| 40 | +```php |
| 41 | +<? |
| 42 | +$Checkfront = new Checkfront( |
| 43 | + array( |
| 44 | + 'host'=>'your-company.checkfront.com', |
| 45 | + 'consumer_key' => '5010076404ec1809470508', |
| 46 | + 'consumer_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e', |
| 47 | + 'redirect_uri'=>'oob', |
| 48 | + ) |
| 49 | +); |
| 50 | +?> |
38 | 51 | ``` |
39 | 52 |
|
40 | | - |
41 | | -## Usage |
42 | | - |
43 | | -The examples are a good place to start, there are several in the `examples` folder. The minimal you'll need to have is: |
| 53 | +##### Token Access |
44 | 54 |
|
45 | 55 | ```php |
46 | | -<?php |
| 56 | +<? |
47 | 57 | $Checkfront = new Checkfront( |
48 | 58 | array( |
49 | 59 | 'host'=>'your-company.checkfront.com', |
50 | | - 'auth_type' => 'token', |
51 | | - 'consumer_key' => 'CHANGE_ME', |
52 | | - 'consumer_secret' => 'CHANGE_ME', |
53 | | - 'account_id' => 'off', |
| 60 | + 'auth_type' => 'token', |
| 61 | + 'api_key' => '5010076404ec1809470508', |
| 62 | + 'api_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e', |
54 | 63 | ) |
55 | 64 | ); |
56 | 65 | ?> |
57 | 66 | ``` |
58 | 67 |
|
59 | 68 | ```php |
60 | | -<?php |
61 | | - // fetch all bookings |
62 | | - public function query_booking($booking_id) { |
63 | | - $response = $this->Checkfront->get('booking/index'); |
64 | | - return $response; |
65 | | - } |
| 69 | +<? |
| 70 | +/* Get items rates and availbility*/ |
| 71 | +$Checkfront->get('item',array( |
| 72 | + 'start_date'=>date('Y-m-d'), |
| 73 | + 'end_date'=>date('Y-m-d',strtotime('+3 days')) |
| 74 | +)); |
66 | 75 | ?> |
67 | 76 | ``` |
0 commit comments