定制 eo/keyclient 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eo/keyclient

Composer 安装命令:

composer require eo/keyclient

包简介

Key Client library for PHP 5.3+

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Total Downloads Latest Stable Version

KeyClient library for PHP 5.3+

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:

{
    "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.

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

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).

To install them all, use Composer:

Step 1: Get Composer

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

Make sure you download composer.phar in the same folder where the composer.json file is located.

Step 2: Install vendors

php composer.phar --dev install

Note that the script takes some time to finish.

Running

First, install the vendors (see above).

Then, run the test suite from the package root directory with the following command:

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.

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

统计信息

  • 总下载量: 161
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固