Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
amochohan committed Jun 16, 2015
0 parents commit d41ca9b
Show file tree
Hide file tree
Showing 9 changed files with 4,017 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.idea
.DS_Store
3 changes: 3 additions & 0 deletions Certificates/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
privatekey.pem
public_privatekey.pfx
publickey.cer
3,869 changes: 3,869 additions & 0 deletions Certificates/ca-bundle.crt

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Facades/XeroPartner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace DrawMyAttention\XeroLaravel\Facades;

use Illuminate\Support\Facades\Facade;

class XeroPartner extends Facade
{
protected static function getFacadeAccessor() { return 'XeroPartner'; }
}
9 changes: 9 additions & 0 deletions Facades/XeroPrivate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace DrawMyAttention\XeroLaravel\Facades;

use Illuminate\Support\Facades\Facade;

class XeroPublic extends Facade
{
protected static function getFacadeAccessor() { return 'XeroPublic'; }
}
9 changes: 9 additions & 0 deletions Facades/XeroPublic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace DrawMyAttention\XeroLaravel\Facades;

use Illuminate\Support\Facades\Facade;

class XeroPrivate extends Facade
{
protected static function getFacadeAccessor() { return 'XeroPrivate'; }
}
46 changes: 46 additions & 0 deletions Providers/XeroServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
namespace DrawMyAttention\XeroLaravel\Providers;

use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Support\ServiceProvider;

class XeroServiceProvider extends ServiceProvider
{
private $config = 'xero/config.php';

public function boot()
{
$this->publishes([
__DIR__.'/../config.php' => config_path($this->config),
]);
}

/**
* Register the service provider.
*
* @return void
*/
public function register()
{
// Use the published configuration file if it exists.
if(file_exists(config_path($this->config))) {
$configPath = config_path($this->config);
$config = include $configPath;
} else {
// Use the default package configuration as a fallback.
$config = include __DIR__.'/../config.php';
}

$this->app->bind('XeroPrivate', function () use ($config) {
return new \XeroPHP\Application\PrivateApplication($config);
});

$this->app->bind('XeroPublic', function () use ($config) {
return new \XeroPHP\Application\PublicApplication($config);
});

$this->app->bind('XeroPartner', function () use ($config) {
return new \XeroPHP\Application\PartnerApplication($config);
});
}
}
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "drawmyattention/xerolaravel",
"description": "A Laravel 5 wrapper for Xero's PHP API",
"require": {
"calcinai/xero-php": "1.1.*"
},
"authors": [
{
"name": "Amo Chohan",
"email": "[email protected]"
}
]
}
57 changes: 57 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

return [

'oauth' => [

/*
|--------------------------------------------------------------------------
| OAuth Callback
|--------------------------------------------------------------------------
|
| Provide a callback URL, or use 'oob' if one isn't required.
|
*/

'callback' => 'oob',

/*
|--------------------------------------------------------------------------
| Xero application authentication
|--------------------------------------------------------------------------
|
| Before using this service, you'll need to register an applicatin via
| the Xero developer website. When setting up your application, take
| note of the consumer key and shared secret, as well as the
| application type (private, public or partner).
|
*/

'consumer_key' => 'YOURCONSUMERKEY',
'consumer_secret' => 'YOURSECRETKEY',

/*
|--------------------------------------------------------------------------
| RSA keys
|--------------------------------------------------------------------------
|
| Ensure that you have generated the required private and public rsa keys
| using the guide provided: http://bit.ly/1dIn55j.
|
| openssl genrsa -out privatekey.pem 1024
| openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 1825
| openssl pkcs12 -export -out public_privatekey.pfx -inkey privatekey.pem -in publickey.cer
|
| The path must follow the format file:// and then the absolute path of the
| keys on the server.
|
| Note: do not omit the first '/' if using a UNIX based filesystem when
| setting the absolute path (so the path should begin with 'file:///'.
|
*/

'rsa_private_key' => 'file:///home/absolutepath/vendor/src/drawmyattention/xerolaravel/Certificates/privatekey.pem',
'rsa_public_key' => 'file:///home/absolutepath/vendor/src/drawmyattention/xerolaravel/Certificates/publickey.cer'
]

];

0 comments on commit d41ca9b

Please sign in to comment.