From 95c69ede3631235d3cf9393355a722e5275722b4 Mon Sep 17 00:00:00 2001 From: lsolesen Date: Thu, 14 Apr 2016 07:52:49 +0000 Subject: [PATCH] Updated docs with composer integration information and added CHANGELOG.md --- CHANGELOG.md | 6 ++++ README.md | 82 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..30bb9a9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +## CHANGELOG + +## 0.1.0 - 2016-04-14 + +- First versioned release of QuickPay PHP Client for QuickPay api v10. +- This release does not break backward compability with previous development versions of the client. diff --git a/README.md b/README.md index ebb96a0..5aa46b5 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,27 @@ quickpay-php-client ====================== -[![Build Status](https://travis-ci.org/QuickPay/quickpay-php-client.svg)](https://travis-ci.org/QuickPay/quickpay-php-client) +[![Build Status](https://travis-ci.org/QuickPay/quickpay-php-client.svg)](https://travis-ci.org/QuickPay/quickpay-php-client) [![Code Coverage](https://scrutinizer-ci.com/g/QuickPay/quickpay-php-client/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/QuickPay/quickpay-php-client/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/QuickPay/quickpay-php-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/QuickPay/quickpay-php-client/?branch=master) [![Latest Stable Version](https://poser.pugx.org/quickpay/quickpay-php-client/v/stable)](https://packagist.org/packages/quickpay/quickpay-php-client) [![Total Downloads](https://poser.pugx.org/quickpay/quickpay-php-client/downloads)](https://packagist.org/packages/quickpay/quickpay-php-client) [![License](https://poser.pugx.org/quickpay/quickpay-php-client/license)](https://packagist.org/packages/quickpay/quickpay-php-client) `quickpay-php-client` is a official client for [QuickPay API](http://tech.quickpay.net/api). The QuickPay API enables you to accept payments in a secure and reliable manner. This package currently support QuickPay `v10` api. ## Installation -Upload `/QuickPay/` to your web space. + +### Composer + +Simply add a dependency on quickpay/quickpay-php-client to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a dependency on newest stable version of QuickPay: + +``` +{ + "require": { + "quickpay/quickpay-php-client": "0.1.*" + } +} +``` + +### Manually upload + +If you cannot use composer and all the goodness the autoloader in composer gives you, you can upload `/QuickPay/` to your web space. However, then you need to manage the autoloading of the classes yourself. ## Usage @@ -14,20 +29,19 @@ Before doing anything you should register yourself with QuickPay and get access ### Create a new client -First you should create a client instance that is anonymous or authorized with `api_key` or login credentials provided by QuickPay. +First you should create a client instance that is anonymous or authorized with `api_key` or login credentials provided by QuickPay. To initialise an anonymous client: ```php5 ``` @@ -35,15 +49,14 @@ To initialise a client with QuickPay Api Key: ```php5 ``` @@ -51,16 +64,15 @@ Or you can provide login credentials like: ```php5 ``` @@ -92,7 +104,7 @@ Getting the `HTTP status code`: $response = $client->request->get('/payments'); $status = $response->http_status(); -if( $status == 200 ) { +if ($status == 200) { // Successful request } ``` @@ -109,11 +121,10 @@ $response_body = $client->request->get('/payments')->as_object(); // Get the response body as an array $response_body = $client->request->get('/payments')->as_array(); - // Example usage $payments = $client->request->get('/payments')->as_array(); -foreach( $payments as $payment ) { +foreach($payments as $payment) { //... } @@ -124,7 +135,8 @@ You can read more about api responses at [http://tech.quickpay.net/api/](http:// ## Tests Use composer to create an autoloader: + ```command -$ composer update -$ phpunit --bootstrap vendor/autoload.php +$ composer install +$ phpunit ```