From 039beded65e64398d31b554bb28f286f83d9f74e Mon Sep 17 00:00:00 2001 From: Maxime Renou Date: Tue, 12 May 2020 17:16:40 +0200 Subject: [PATCH] Renaming --- README.md | 25 ++++++++++------------ composer.json | 12 ++++++----- src/BMailException.php | 5 ----- src/{BMailApi.php => BluescaleMailApi.php} | 9 ++++---- .../BMailChannel.php => BluescaleMailChannel.php} | 8 +++---- src/BluescaleMailException.php | 5 +++++ ...ovider.php => BluescaleMailServiceProvider.php} | 8 +++++-- ...BMailTemplate.php => BluescaleMailTemplate.php} | 4 ++-- 8 files changed, 40 insertions(+), 36 deletions(-) delete mode 100644 src/BMailException.php rename src/{BMailApi.php => BluescaleMailApi.php} (88%) rename src/{Broadcasting/BMailChannel.php => BluescaleMailChannel.php} (72%) create mode 100644 src/BluescaleMailException.php rename src/{BMailServiceProvider.php => BluescaleMailServiceProvider.php} (68%) rename src/{BMailTemplate.php => BluescaleMailTemplate.php} (97%) diff --git a/README.md b/README.md index b98842d..5762b69 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# laravel-bmail +# laravel-mail The Bluescale Mail package allows you to send Bluescale Mail templates using Laravel notifications system. @@ -8,27 +8,24 @@ First in your composer.json, add: ``` "require": { - "bluescale/laravel-bmail": "dev-master" + "bluescale/laravel-bmail": "dev-master" } -``` - -``` "repositories": [ - { - "type": "vcs", - "url": "https://git.bluesquare.io/bluescale/laravel-bmail" - } + { + "type": "vcs", + "url": "https://git.bluesquare.io/bluescale/laravel-bmail" + } ] ``` -Next, update your package: +Next, install the package: ```bash composer update bluescale/laravel-bmail ``` -Eventually, if you want to customize the config system: +If you want to customize the config system: ```bash php artisan vendor:publish @@ -54,10 +51,10 @@ First, create a new notification or use an existing one: php artisan make:notification MyAwesomeNotification ``` -Add BMailChannel in the `via()` method: +Add BluescaleMailChannel in the `via()` method: ```php -return [BMailChannel::class]; +return [BluescaleMailChannel::class]; ``` Then, create a 'toTemplate()' method, in which you specify your template fields : @@ -65,7 +62,7 @@ Then, create a 'toTemplate()' method, in which you specify your template fields ```php public function toTemplate($notifiable) { - return (new BMailTemplate("my-template-id")) + return (new BluescaleMailTemplate("my-template-id")) ->sender("john.doe@gmail.com", "John OPTIONAL") // OPTIONAL ->replyTo("jean.grey@gmail.com", "Jean OPTIONAL") // OPTIONAL ->recipients([ diff --git a/composer.json b/composer.json index b1eed97..a7fc38a 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,16 @@ { - "name": "bluescale/laravel-bmail", - "description": "Send email templates on Laravel to the Bluescale API.", + "name": "bluescale/laravel-mail", + "description": "Send Bluescale Mail templates from your Laravel notifications.", "keywords": [ "package", "bluescale", + "bmail", + "mail", "api", "template", "email" ], - "homepage": "https://git.bluesquare.io/bluescale/laravel-bmail", + "homepage": "https://git.bluesquare.io/bluescale/laravel-mail", "license": "proprietary", "authors": [ { @@ -21,13 +23,13 @@ "minimum-stability": "dev", "autoload": { "psr-4": { - "BMail\\": "src/" + "Bluescale\\Mail\\": "src/" } }, "extra": { "laravel": { "providers": [ - "BMail\\BMailServiceProvider" + "Bluescale\\Mail\\BluescaleMailServiceProvider" ] } }, diff --git a/src/BMailException.php b/src/BMailException.php deleted file mode 100644 index dc915b1..0000000 --- a/src/BMailException.php +++ /dev/null @@ -1,5 +0,0 @@ -getBody(); } catch(\Exception $e) { - throw new BMailException($e->getMessage()); + throw new BluescaleMailException($e->getMessage()); } } } diff --git a/src/Broadcasting/BMailChannel.php b/src/BluescaleMailChannel.php similarity index 72% rename from src/Broadcasting/BMailChannel.php rename to src/BluescaleMailChannel.php index aca3ab7..2d28cf2 100644 --- a/src/Broadcasting/BMailChannel.php +++ b/src/BluescaleMailChannel.php @@ -1,11 +1,11 @@ toTemplate($notifiable); - return (new BMailApi(config("bmail.api_key")))->send($template, $notifiable); + return $api->send($template, $notifiable); } } diff --git a/src/BluescaleMailException.php b/src/BluescaleMailException.php new file mode 100644 index 0000000..f02581f --- /dev/null +++ b/src/BluescaleMailException.php @@ -0,0 +1,5 @@ +app->singleton(BluescaleMailApi::class, function ($app) { + return new BluescaleMailApi($app['config']['bmail']['api_key']); + }); } /** diff --git a/src/BMailTemplate.php b/src/BluescaleMailTemplate.php similarity index 97% rename from src/BMailTemplate.php rename to src/BluescaleMailTemplate.php index 6913c33..37a7e5e 100644 --- a/src/BMailTemplate.php +++ b/src/BluescaleMailTemplate.php @@ -1,8 +1,8 @@