Skip to content

Commit 3760fc9

Browse files
committed
Allows override of the MandrillFactory class
1 parent be604ca commit 3760fc9

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

src/Jlinn/Mandrill/MandrillServiceProvider.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ class MandrillServiceProvider extends ServiceProvider
88
{
99
protected $defer = false;
1010

11-
public function boot()
11+
public function register()
1212
{
1313
$this->package('jlinn/mandrill-api-php');
14-
}
1514

16-
public function register()
17-
{
18-
$this->app->bind('mandrill', function ()
15+
$this->app['mandrill'] = $this->app->share(function ($app)
1916
{
20-
$config = $this->app->config->get('mandrill-api-php::config');
21-
return new MandrillFactory($config['secret']);
17+
$config = $app->config->get('mandrill-api-php::config');
18+
$factory = "\\{$config['factory']}";
19+
return new $factory($config['secret']);
2220
});
2321
}
2422

src/config/config.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
| Change 'changeme' with your Mandrill Secret Key.
1111
|
1212
*/
13-
'secret' => 'changeme'
13+
'secret' => 'changeme',
14+
15+
/*
16+
|--------------------------------------------------------------------------
17+
| Custom Factory Class
18+
|--------------------------------------------------------------------------
19+
|
20+
| If you wish to have a custom factory class to enhance the functionality of the library, feel free to override it.
21+
|
22+
*/
23+
'factory' => 'Jlinn\Mandrill\MandrillFactory'
1424

1525
);

0 commit comments

Comments
 (0)