accepton/accepton

Get paid in your customer's preferred method

v0.2.0 2016-04-27 18:49 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:06:38 UTC


README

Build Status

Documentation

Please see the PHP developer documentation for more information.

Installation

You can install the package via Composer:

$ composer require accepton/accepton

And then use Composer's autoload to require it:

require_once("vendor/autoload.php");

Getting Started

This library uses the HTTPlug interface to abstract the specific HTTP client and PSR-7 message factory used in the client. If you do not already have an HTTPlug-compatible client and PSR-7 message factory installed, you will need to install one.

Your HTTPClient and MessageFactory can then be auto-discovered using Puli.

See the list of HTTP clients to choose from. Also, the HTTPlug project has quick start instructions for a number of the clients.

Using Service Discovery

As a quick start, you can install these packages via composer, which will give you the following:

  1. A Guzzle-based HTTP client.
  2. A PHP-HTTP Guzzle message factory.
  3. Puli for auto-discovery.
$ composer require \
    php-http/guzzle6-adapter \
    php-http/message \
    puli/composer-plugin \
    puli/repository \
    puli/discovery

Then, initialize the client like so:

use AcceptOn\Client;

$client = new Client(API_KEY, "staging");

Without Service Discovery

If you prefer not to use Puli, you can install one of HTTP clients and accompanying message factories using Composer. For example, if you want to use Guzzle6, run:

$ composer require php-http/guzzle6-adapter php-http/message

The php-http/guzzle6-adapter contains the HTTPlug client and php-http/message contains the message factory.

Then, initialize the client like so:

use AcceptOn\Client;
use Http\Adapter\Guzzle6\Client as HttpClient;
use Http\Message\MessageFactory\GuzzleMessageFactory as MessageFactory;

$httpClient = new HttpClient();
$messageFactory = new MessageFactory();

$client = new Client(API_KEY, "staging");
$client->setHttpClient($httpClient);
$client->setMessageFactory($messageFactory);

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write your code and unit tests
  4. Ensure all tests still pass (bundle exec rspec)
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create a new pull request