2017 © Pedro Peláez
 

library keyclient

Key Client library for PHP 5.3+

image

eo/keyclient

Key Client library for PHP 5.3+

  • Wednesday, July 16, 2014
  • by eymengunay
  • Repository
  • 1 Watchers
  • 6 Stars
  • 95 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

PHP KEYCLIENT LIBRARY

Build Status Scrutinizer Code Quality Code Coverage Total Downloads Latest Stable Version, (*1)

KeyClient library for PHP 5.3+, (*2)

Installing

Using Composer

To add PHP-KeyClient as a local, per-project dependency to your project, simply add a dependency on eo/keyclient to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a development-time dependency on the latest version of the library:, (*3)

{
    "require": {
        "eo/keyclient": "dev-master"
    }
}

Usage Example

Workflow

                                                    --> canceled
                                                    |
Create payment url –> Redirect user to payment url -|
                                                    |
                                                    --> confirmed -> Handle return response

Creating payment url

<?php

use Eo\KeyClient\Client;
use Eo\KeyClient\Payment\PaymentRequest;

$client  = new Client('YOUR-ALIAS', 'YOUR-SECRET');
$payment = new PaymentRequest(5000, 'EUR', 'UNIQUE-ID', 'http://example.com/completed', 'http://example.com/canceled');

$url = $client->createPaymentUrl($payment);

// Redirect to payment url
header( "Location: $url" );

Handling return response

<?php

use Eo\KeyClient\Client;

$client   = new Client('YOUR-ALIAS', 'YOUR-SECRET');
$response = $client->parsePaymentResponse();

// $response is an instance of Eo\KeyClient\Payment\PaymentResponse
switch ($response->get('esito')) {
    case 'OK':
        # Payment success...
        break;
    case 'KO':
        # Payment error...
        break;
}

Requirements

  • PHP 5.3+

Breaking Changes

Version 0.2.0

Running Tests

Before submitting a patch for inclusion, you need to run the test suite to check that you have not broken anything., (*4)

To run the test suite, install PHPUnit 3.7 (or later) first., (*5)

Dependencies

To run the entire test suite, including tests that depend on external dependencies, php-keyclient needs to be able to autoload them. By default, they are autoloaded from vendor/ under the main root directory (see vendor/autoload.php)., (*6)

To install them all, use Composer:, (*7)

Step 1: Get Composer, (*8)

curl -s http://getcomposer.org/installer | php

Make sure you download composer.phar in the same folder where the composer.json file is located., (*9)

Step 2: Install vendors, (*10)

php composer.phar --dev install

Note that the script takes some time to finish., (*11)

Running

First, install the vendors (see above)., (*12)

Then, run the test suite from the package root directory with the following command:, (*13)

phpunit

The output should display OK. If not, you need to figure out what's going on and if the tests are broken because of your modifications., (*14)

Reporting an issue or a feature request

Issues and feature requests related to this library are tracked in the Github issue tracker: https://github.com/eymengunay/php-keyclient/issues, (*15)

The Versions

16/07 2014

dev-master

9999999-dev https://github.com/eymengunay/php-keyclient

Key Client library for PHP 5.3+

  Sources   Download

MIT

The Requires

 

The Development Requires

keyclient cartasi

01/06 2014

v0.2.0

0.2.0.0 https://github.com/eymengunay/php-keyclient

Key Client library for PHP 5.3+

  Sources   Download

MIT

The Requires

 

The Development Requires

keyclient cartasi

24/04 2014

v0.1.1

0.1.1.0 https://github.com/eymengunay/php-keyclient

Key Client library for PHP 5.3+

  Sources   Download

MIT

The Development Requires

keyclient cartasi

22/04 2014

v0.1.0

0.1.0.0 https://github.com/eymengunay/php-keyclient

Key Client library for PHP 5.3+

  Sources   Download

MIT

The Development Requires

keyclient cartasi