Skip to content

Commit

Permalink
Added laravel integration
Browse files Browse the repository at this point in the history
  • Loading branch information
tpavlek committed Nov 27, 2014
1 parent 3a97c5c commit e747e9f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Troy Pavlek",
"email": "troy@depotwarehouse.net",
"homepage": "http://depotwarehouse.net",
"homepage": "http://tpavlek.me",
"role": "Developer"
}
],
Expand All @@ -16,10 +16,14 @@
}
},
"require": {
"php": ">=5.5.0",
"league/oauth2-client": "~0.3"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "4.2.*"
},
"suggest": {
"illuminate/support": "Laravel integration"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace Depotwarehouse\OAuth2\Client\FrameworkIntegration\Laravel;


use Depotwarehouse\OAuth2\Client\Provider\BattleNet;
use Illuminate\Support\ServiceProvider;

class BattleNetOAuth2ServiceProvider extends ServiceProvider {

/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->package('depotwarehouse/oauth2-bnet', null, __DIR__);
$this->app->bind(BattleNet::class, function () {
return new BattleNet([
'clientId' => \Config::get('oauth2-bnet::clientId'),
'clientSecret' => \Config::get('oauth2-bnet::clientSecret'),
'redirectUri' => \Config::get('oauth2-bnet::redirectUri'),
]);
});
}

public function boot()
{

}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array();
}
}
6 changes: 6 additions & 0 deletions src/FrameworkIntegration/Laravel/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
return [
'clientId' => getenv('BNET_CLIENT_ID'),
'clientSecret' => getenv('BNET_CLIENT_SECRET'),
'redirectUri' => getenv("BNET_REDIRECT_URI")
];

0 comments on commit e747e9f

Please sign in to comment.