Please see the PHP developer documentation for more information.
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");
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.
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");
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);
- 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