accepton / accepton
Get paid in your customer's preferred method
Requires
- php: >=5.5.0
- php-http/client-implementation: ^1.0
- php-http/discovery: ^0.8
- psr/http-message-implementation: ^1.0
Requires (Dev)
- d11wtq/boris: ^1.0
- internations/http-mock: ^0.7.4
- php-http/guzzle6-adapter: ^1.0
- php-http/message: ^1.2
- phpmd/phpmd: ^2.4
- phpunit/phpunit: ^5.3
- puli/composer-plugin: ^1.0@beta
- sebastian/phpcpd: ^2.0
- sensiolabs/security-checker: ^3.0
- squizlabs/php_codesniffer: ^2.6
- vinkla/climb: ^0.8.1
This package is not auto-updated.
Last update: 2024-04-13 15:06:38 UTC
README
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:
- A Guzzle-based HTTP client.
- A PHP-HTTP Guzzle message factory.
- 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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Write your code and unit tests
- Ensure all tests still pass (
bundle exec rspec
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new pull request