Skip to content

Commit cdedc88

Browse files
committed
Expanded examples, cleaned up and expanded for other developers to kickstart their projects
Formatting corrections
1 parent 39ad9f6 commit cdedc88

File tree

3 files changed

+69
-67
lines changed

3 files changed

+69
-67
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
.Trashes
88
ehthumbs.db
99
Thumbs.db
10-
10+
.env
1111

1212
# Development
1313
######################
14-
composer.lock
15-
vendor
14+
vendor

README.md

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ The [Checkfront Booking API](http://www.checkfront.com/developers/api/) allows y
88
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
99
(http://www.apache.org/licenses/LICENSE-2.0.html)
1010

11-
11+
---
1212

1313
## Features
14-
---
1514

1615
The Checkfront API SDK provides the following functionality:
1716

@@ -25,7 +24,6 @@ The Checkfront API SDK provides the following functionality:
2524

2625

2726
## Installation & Usage
28-
---
2927

3028
This repo is setup to extend off of the library created by Checkfront. To update this library, a Composer.json file has been created.
3129

@@ -35,44 +33,47 @@ If you are not using [Composer](http://getcomposer.org), you should be. It's an
3533

3634
Let's install Checkfront-PHP-DK via the following few commands:
3735

38-
> Type `composer` for more options:
36+
> Type `composer` for more options:
3937
4038
```
4139
$ composer init --require="checkfront/checkfront:3.0.*" -n
4240
$ composer install
4341
```
4442

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-
4843
```bash
4944
require 'vendor/autoload.php';
5045
```
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.
47+
Obtain API credintials [https://{your-company}.checkfront.com/manage/developer/](https://{your-company}.checkfront.com/manage/developer/)
48+
49+
50+
51+
---
5152

5253
> The repo example files are a good place to start.
5354
5455
```shell
5556
PHP-SDK # → Root of Service
56-
└── examples/
57+
└── examples/
5758
└── 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
59+
├── Cart.php # → Main wrapper class, ADD API KEY
60+
├── create.php # → Process $_POST request, add to cart session
61+
├── Form.php # → Various PHP functions
62+
├── index.php # → Default view, list available inventory
63+
└── README.md # → File overview & tips
6364
```
6465

6566
#### OAuth2 Access
6667

6768
```php
6869
<?php
6970
$Checkfront = new Checkfront(
70-
array(
71-
'host' => 'your-company.checkfront.com',
72-
'consumer_key' => '5010076404ec1809470508',
73-
'consumer_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
74-
'redirect_uri' => 'oob',
75-
));
71+
array(
72+
'host' => 'your-company.checkfront.com',
73+
'consumer_key' => '5010076404ec1809470508',
74+
'consumer_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
75+
'redirect_uri' => 'oob',
76+
));
7677
?>
7778
```
7879

@@ -81,31 +82,31 @@ $Checkfront = new Checkfront(
8182
```php
8283
<?php
8384
$Checkfront = new Checkfront(
84-
array(
85-
'host'=>'your-company.checkfront.com',
86-
'auth_type' => 'token',
87-
'api_key' => '5010076404ec1809470508',
88-
'api_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
89-
));
85+
array(
86+
'host'=>'your-company.checkfront.com',
87+
'auth_type' => 'token',
88+
'api_key' => '5010076404ec1809470508',
89+
'api_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
90+
));
9091
?>
9192
```
9293

93-
### PHP Examples
94+
#### PHP Examples
9495
```php
9596
<?php
9697
// Get items rates and availbility
9798
$items = $Checkfront->get('item',array(
98-
'start_date'=>date('Y-m-d'),
99-
'end_date'=>date('Y-m-d',strtotime('+3 days'))
100-
));
99+
'start_date'=>date('Y-m-d'),
100+
'end_date'=>date('Y-m-d',strtotime('+3 days'))
101+
));
101102

102103
print_r( $items );
103104

104105
// fetch all bookings
105106
public function query_booking()
106107
{
107-
$response = $this->Checkfront->get('booking/index');
108-
return $response;
108+
$response = $this->Checkfront->get('booking/index');
109+
return $response;
109110
}
110111

111112
print_r(query_booking() );
@@ -134,12 +135,23 @@ Move the following example file `notifications-example.php` to a place of your c
134135
### Notification Service Breakdown
135136

136137
```shell
137-
PHP-SDK # → Root of Service
138-
└── scripts/
138+
PHP-SDK # → Root of Service
139+
└── scripts/
139140
└── 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
141+
├── includes
142+
├── db.class.php # → DB Interface Class
143+
└── notifications.class.php # → Parse of incoming data
144+
├── notifications-example.php # → Processing Example file
145+
└── notifications.sql # → DB Example File
145146
```
147+
148+
149+
## Contributing
150+
151+
1. Fork it
152+
2. Create your feature branch (`git checkout -b my-new-feature`)
153+
3. Make your changes
154+
4. Run the tests, adding new ones for your own code if necessary (`phpunit`)
155+
5. Commit your changes (`git commit -am 'Added some feature'`)
156+
6. Push to the branch (`git push origin my-new-feature`)
157+
7. Create new Pull Request

examples/cart/README.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,39 @@
1-
Sample Reservation System
2-
==========================
1+
## Reservations Booking Demo
32

4-
The Booking Cart demo is a bare bones shopping card style booking page. It is not intended
5-
for production use, and should act an example only. It's missing key validation and error
6-
checking.
3+
In this directory you will find examples and a working bare bones reservation booking system. Not intended for *production* use, and should act as an example to create an even better system. It is missing important validation and error checking.
74

5+
##### QUICK GUIDE
6+
Change `HOST`, `CONSUMER_KEY` and `CONSUMER_SECRET` within `Cart.php` file, this information can be obtained via your Checkfront account.
87

9-
index.php
10-
---------
118

12-
The first page fetches available inventory based on the selected date (defaults to today) and
13-
allows you to add multiple items to your session.
9+
### index.php
1410

15-
API calls:
11+
Default page fetches available inventory based on the selected date (defaults to today) and allows you to add multiple items.
12+
13+
**API calls:**
1614

1715
```
1816
booking/session
1917
item
2018
```
2119

22-
create.php
23-
----------
24-
25-
The create booking page is passed the cart id and the booking form fields are requested from
26-
Checkfront and rendered on the page.
20+
### create.php
2721

28-
Once a successful booking/create call has been completed, a url will be returned in the response. The
29-
url can differ depending on the booking and your configuration.
22+
Booking form fields are requested from Checkfront via API and rendered on the page.
3023

24+
Once a successful `booking/create` call has been completed, a url will be returned in the response. The url can differ depending on the booking and your configuration.
3125

32-
API calls:
33-
26+
**API calls:**
27+
```
3428
booking/session
3529
booking/create
3630
booking/form
31+
```
3732

3833

39-
Form.php
40-
--------
41-
34+
### Form.php
4235
The form class is an optional helper class that renders the form fields into html.
4336

4437

45-
Cart.php
46-
--------
47-
48-
Main wrapper class that encapsulates the Checkfront API and extends some custom calls. Add API Key & API Secret to this file.
38+
### Cart.php
39+
Main wrapper class that encapsulates the Checkfront API and extends some custom calls.

0 commit comments

Comments
 (0)