This package is a laravel 5 wrapper for the GoCardless API. This package is in PreRelease and currently relies on dev-master. When ready for release, it will be tagged correctly.
This package requires PHP 5.6+, and comes with a Laravel 5 Service Provider and Facade for Laravel integration. Please note, you do not need to have laravel installed to use this package.
To install through composer include the package in your composer.json
.
"midnite81/gocardless": "dev-master"
Run composer install
or composer update
to download the dependencies or you can
run composer require midnite81/gocardless
.
To use the package with Laravel 5 add the GoCardless Service Provider to the list of Service Providers
in app/config/app.php
.
'providers' => [
...
Midnite81\GoCardless\GoCardlessServiceProvider::class
...
];
Add the GoCardless
facade to your aliases array.
'aliases' => [
'GoCardless' => Midnite81\GoCardless\Facades\GoCardless::class,
];
Publish the config and migration files using
php artisan vendor:publish --provider="Midnite81\GoCardless\GoCardlessServiceProvider"
Once you have published the files, you will need to update your .env
to include the following env keys.
GOCARDLESS_ENVIRONMENT=<live|sandbox>
GOCARDLESS_API_KEY_PRODUCTION=<your production api key>
GOCARDLESS_API_KEY_SANDBOX=<your sandbox api key>
GOCARDLESS_PUBLISH_MIGRATIONS=<true|false>
You should take a look at the config/gocardless.php
configuration file as there are a number of settings you should be
aware of. For example, you can prefix migrations with a custom prefix of your own. Please update these if necessary.
To access GoCardless you can either use the Facade or the GoCardless Client instance is bound to the IOC container and you can then dependency inject it via its contract.
GoCardless::getClient();
public function __construct(Midnite81\GoCardless\Contracts\Services\Client $client)
{
$this->client = $client;
}