diff --git a/README.md b/README.md index e0f5a18..3bf6e1e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,15 @@ A very basic Laravel wrapper for the [Dotmailer API Client](https://github.com/r To install, inside your project directory run the following from your terminal: - composer require "industrious-mouse/laravel-dotmailer": "dev-master" + composer require industrious-mouse/laravel-dotmailer + +Then load the service provider in your config/app.php: + + IndustriousMouse\LaravelDotmailer\LaravelDotmailerServiceProvider::class + +You'll also need to publish the config, so you can provide your keys: + + php artisan vendor:publish --provider="IndustriousMouse\LaravelDotmailer\LaravelDotmailerServiceProvider" ## Examples @@ -23,7 +31,7 @@ To install, inside your project directory run the following from your terminal: ] ] ]); - + try { $contact = Dotmailer::PostContacts($contact_data); @@ -32,7 +40,7 @@ To install, inside your project directory run the following from your terminal: { return $e; } - + ### Sending a Campaign to a contact diff --git a/config/dotmailer.php b/config/dotmailer.php index a07d13b..ca12a3a 100644 --- a/config/dotmailer.php +++ b/config/dotmailer.php @@ -2,7 +2,7 @@ return [ - 'username' => '', - 'password' => '' + 'username' => env('DOTMAILER_USERNAME'), + 'password' => env('DOTMAILER_PASSWORD') ]; \ No newline at end of file diff --git a/src/LaravelDotmailerServiceProvider.php b/src/LaravelDotmailerServiceProvider.php index c443b48..3b41bf5 100644 --- a/src/LaravelDotmailerServiceProvider.php +++ b/src/LaravelDotmailerServiceProvider.php @@ -11,13 +11,6 @@ */ class LaravelDotmailerServiceProvider extends ServiceProvider { - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = false; - /** * Boot the service provider. * @@ -25,9 +18,7 @@ class LaravelDotmailerServiceProvider extends ServiceProvider { */ public function boot() { - $this->publishes([ - __DIR__.'/../config/dotmailer.php' => config_path('dotmailer.php'), - ]); + $this->registerConfig(); } /** @@ -58,4 +49,15 @@ public function provides() { return []; } + + /** + * Registers Configuration + */ + private function registerConfig() + { + $configPath = __DIR__ . '/../config/dotmailer.php'; + + $this->publishes([$configPath => config_path('dotmailer.php')], 'dotmailer'); + $this->mergeConfigFrom($configPath, 'dotmailer'); + } } \ No newline at end of file