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
|
||||
```
|
||||
|
||||
Finally add your API key in the .env :
|
||||
Finally get your API key :
|
||||
|
||||
```bash
|
||||
BMAIL_API_KEY=your_key
|
||||
BMAIL_API_URL=the_api_url
|
||||
Connect to https://bluescale.email, go to the Templates tab, click on the API button and copy your API key.
|
||||
```
|
||||
|
||||
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
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
}
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.5"
|
||||
}
|
||||
"guzzlehttp/guzzle": "^6.5",
|
||||
"php": "^7.2"
|
||||
},
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace BMail;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
class BMailApi
|
||||
{
|
||||
|
@ -25,7 +24,7 @@ class BMailApi
|
|||
* @return \Psr\Http\Message\StreamInterface
|
||||
* @throws BMailException
|
||||
*/
|
||||
public function send($template)
|
||||
public function send($template): StreamInterface
|
||||
{
|
||||
$url = config('bmail.api_url');
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace BMail;
|
||||
|
||||
|
||||
class BMailException extends \Exception {}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace BMail;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
|
||||
class BMailServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace BMail;
|
||||
|
||||
class BMailTemplate implements \JsonSerializable
|
||||
|
@ -153,7 +152,7 @@ class BMailTemplate implements \JsonSerializable
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'template' => $this->template,
|
||||
|
@ -168,5 +167,4 @@ class BMailTemplate implements \JsonSerializable
|
|||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace BMail;
|
||||
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue