Skip to content

Commit

Permalink
Create AwsServiceProvider.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ryihan committed Apr 28, 2021
1 parent 4212f37 commit 08f80d4
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/AwsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php namespace Aws\Laravel;
use Aws\Sdk;
use Illuminate\Foundation\Application as LaravelApplication;
use Illuminate\Support\ServiceProvider;
use Laravel\Lumen\Application as LumenApplication;
class AwsServiceProvider extends ServiceProvider
{
const VERSION = '3.6.0';
protected $defer = true;
public function boot()
{
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
$this->publishes(
[__DIR__.'/../config/aws_publish.php' => config_path('aws.php')],
'aws-config'
);
} elseif ($this->app instanceof LumenApplication) {
$this->app->configure('aws');
}
}
public function register()
{
$this->mergeConfigFrom(
__DIR__.'/../config/aws_default.php',
'aws'
);

$this->app->singleton('aws', function ($app) {
$config = $app->make('config')->get('aws');

return new Sdk($config);
});

$this->app->alias('aws', 'Aws\Sdk');
}
public function provides()
{
return ['aws', 'Aws\Sdk'];
}

}

0 comments on commit 08f80d4

Please sign in to comment.