Renaming
This commit is contained in:
parent
f0a31cb9e8
commit
039beded65
25
README.md
25
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([
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace BMail;
|
||||
|
||||
class BMailException extends \Exception {}
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace BMail;
|
||||
namespace Bluescale\Mail;
|
||||
|
||||
use Bluescale\Mail\BluescaleMailTemplate;
|
||||
use GuzzleHttp\Client;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
class BMailApi
|
||||
class BluescaleMailApi
|
||||
{
|
||||
/**
|
||||
* The API key
|
||||
|
@ -20,7 +21,7 @@ class BMailApi
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $template
|
||||
* @param BluescaleMailTemplate $template
|
||||
* @param $notifiable
|
||||
* @return \Psr\Http\Message\StreamInterface
|
||||
* @throws BMailException
|
||||
|
@ -57,7 +58,7 @@ class BMailApi
|
|||
])->getBody();
|
||||
|
||||
} catch(\Exception $e) {
|
||||
throw new BMailException($e->getMessage());
|
||||
throw new BluescaleMailException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace BMail;
|
||||
namespace Bluescale\Mail;
|
||||
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
class BMailChannel
|
||||
class BluescaleMailChannel
|
||||
{
|
||||
/**
|
||||
* @param $notifiable
|
||||
|
@ -13,10 +13,10 @@ class BMailChannel
|
|||
* @return \Psr\Http\Message\StreamInterface
|
||||
* @throws BMailException
|
||||
*/
|
||||
public function send($notifiable, Notification $notification): StreamInterface
|
||||
public function send($notifiable, Notification $notification, BluescaleMailApi $api): StreamInterface
|
||||
{
|
||||
$template = $notification->toTemplate($notifiable);
|
||||
|
||||
return (new BMailApi(config("bmail.api_key")))->send($template, $notifiable);
|
||||
return $api->send($template, $notifiable);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Bluescale\Mail;
|
||||
|
||||
class BluescaleMailException extends \Exception {}
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace BMail;
|
||||
namespace Bluescale\Mail;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BMailServiceProvider extends ServiceProvider
|
||||
class BluescaleMailServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
|
@ -17,6 +17,10 @@ class BMailServiceProvider extends ServiceProvider
|
|||
__DIR__ . '/../config/bmail.php',
|
||||
'bmail'
|
||||
);
|
||||
|
||||
$this->app->singleton(BluescaleMailApi::class, function ($app) {
|
||||
return new BluescaleMailApi($app['config']['bmail']['api_key']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace BMail;
|
||||
namespace Bluescale\Mail;
|
||||
|
||||
class BMailTemplate implements \JsonSerializable
|
||||
class BluescaleMailTemplate implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* The template for the message
|
Loading…
Reference in New Issue