Skip to content

Commit

Permalink
Initial build.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThompsonTLDR committed Aug 12, 2016
0 parents commit 9ffff5b
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
composer.lock
composer.phar
phpunit.xml
vendor
24 changes: 24 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "christhompsontldr/laravel-recurly",
"homepage": "https://github.com/ChrisThompsonTLDR/laravel-recurly",
"description": "A simple Laravel 5 service provider for including the Recurly PHP client.",
"keywords": ["laravel","laravel 5","recurly","recurring","billing","api"],
"license":"MIT",
"authors":[
{
"name":"Chris Thompson",
"email":"[email protected]",
"homepage":"https://christhompsontldr.com"
}
],
"require": {
"php": ">=5.3.0",
"recurly/recurly-client": "2.6.*"
},
"autoload": {
"psr-4": {
"Christhompsontldr\\LaravelRecurly\\": "src/"
}
}
}
ds
17 changes: 17 additions & 0 deletions config/recurly.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
return [
/**
* Your Recurly subdomain
*/
'subdomain' => env('RECURLY_SUBDOMAIN'),

/**
* API key to connect to Recurly
*/
'api_key' => env('RECURLY_API_KEY'),

/**
* Only needed if you plan on using the Recurly JS lib.
*/
'private_key' => env('RECURLY_PRIVATE_KEY'),
];
45 changes: 45 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
recurly-client-laravel
======================

Integrates the Recurly API with Laravel 5

A simple [Laravel 5](http://four.laravel.com/) service provider for including the [Recurly PHP Client](https://github.com/recurly/recurly-client-php).

## Installation

Install via [Composer](http://getcomposer.org) by requiring the
`christhompsontldr/laravel-recurly` package in your project's `composer.json`.

```json
{
"require": {
"christhompsontldr/laravel-recurly": "1.*"
}
}
```

Run composer update to pull in the libraries.
```bash
composer update
```


## Configure

To use the Recurly Service Provider, you must register the provider when bootstrapping your Laravel application.

Add 'Christhompsontldr\LaravelRecurly\ServiceProvider' to the list of service providers in app/config/app.php
```php
'Christhompsontldr\LaravelRecurly\ServiceProvider::class,',
```

Create a config file for the package
```bash
php artisan config:publish christhompsontldr/laravel-recurly
```

Add your Recurly information to the your .env file using the keys found in config/recurly.php.

## Usage

http://docs.recurly.com/client-libraries/php
41 changes: 41 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Christhompsontldr\LaravelRecurly;

use \Recurly_Client;
use \Recurly_js;

class ServiceProvider extends \Illuminate\Support\ServiceProvider {

/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;

/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
// config
$this->publishes([
realpath(dirname(__DIR__)) . '/config/recurly.php' => config_path('recurly.php'),
], 'config');
}

/**
* Register the service provider.
*
* @return void
*/
public function register()
{
Recurly_Client::$subdomain = config('recurly.subdomain', null);
Recurly_Client::$apiKey = config('recurly.api_key', null);
Recurly_js::$privateKey = config('recurly.private_key', null);
}
}

0 comments on commit 9ffff5b

Please sign in to comment.