Return type hints, psr, readme.md, composer.json
This commit is contained in:
parent
bf5fc9e23a
commit
f1da79c869
12
README.md
12
README.md
|
@ -35,11 +35,17 @@ Then publish the assets from your provider :
|
||||||
php artisan vendor:publish
|
php artisan vendor:publish
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally add your API key in the .env :
|
Finally get your API key :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
BMAIL_API_KEY=your_key
|
Connect to https://bluescale.email, go to the Templates tab, click on the API button and copy your API key.
|
||||||
BMAIL_API_URL=the_api_url
|
```
|
||||||
|
|
||||||
|
And add it in your .env, along with the API URL :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
BMAIL_API_KEY=your_api_key
|
||||||
|
BMAIL_API_URL=https://bluescale.email/api/project/template/send
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"guzzlehttp/guzzle": "^6.5"
|
"guzzlehttp/guzzle": "^6.5",
|
||||||
}
|
"php": "^7.2"
|
||||||
|
},
|
||||||
|
"prefer-stable": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace BMail;
|
namespace BMail;
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
|
||||||
class BMailApi
|
class BMailApi
|
||||||
{
|
{
|
||||||
|
@ -25,7 +24,7 @@ class BMailApi
|
||||||
* @return \Psr\Http\Message\StreamInterface
|
* @return \Psr\Http\Message\StreamInterface
|
||||||
* @throws BMailException
|
* @throws BMailException
|
||||||
*/
|
*/
|
||||||
public function send($template)
|
public function send($template): StreamInterface
|
||||||
{
|
{
|
||||||
$url = config('bmail.api_url');
|
$url = config('bmail.api_url');
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace BMail;
|
namespace BMail;
|
||||||
|
|
||||||
|
|
||||||
class BMailException extends \Exception {}
|
class BMailException extends \Exception {}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace BMail;
|
namespace BMail;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
|
||||||
class BMailServiceProvider extends ServiceProvider
|
class BMailServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace BMail;
|
namespace BMail;
|
||||||
|
|
||||||
class BMailTemplate implements \JsonSerializable
|
class BMailTemplate implements \JsonSerializable
|
||||||
|
@ -153,7 +152,7 @@ class BMailTemplate implements \JsonSerializable
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray()
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'template' => $this->template,
|
'template' => $this->template,
|
||||||
|
@ -168,5 +167,4 @@ class BMailTemplate implements \JsonSerializable
|
||||||
{
|
{
|
||||||
return $this->toArray();
|
return $this->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace BMail;
|
namespace BMail;
|
||||||
|
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
|
||||||
class BMailChannel
|
class BMailChannel
|
||||||
{
|
{
|
||||||
public function send($notifiable, Notification $notification)
|
/**
|
||||||
|
* @param $notifiable
|
||||||
|
* @param Notification $notification
|
||||||
|
* @return \Psr\Http\Message\StreamInterface
|
||||||
|
* @throws BMailException
|
||||||
|
*/
|
||||||
|
public function send($notifiable, Notification $notification): StreamInterface
|
||||||
{
|
{
|
||||||
$template = $notification->toTemplate($notifiable);
|
$template = $notification->toTemplate($notifiable);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue