Skip to content

Commit

Permalink
Support Laravel package auto discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
nauxliu committed Feb 27, 2019
1 parent 2101b8b commit 574974f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 41 deletions.
29 changes: 5 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
# Laravel-SendCloud
Laravel 5.X 的 SendCloud 驱动

> `Laravel 5.5` 以下请使用 `1.1.3` 版本
Laravel 5.X 使用的 SendCloud 驱动,发送方式完全兼容官方用法,可随时修改配置文件改为其他驱动,而不需要改动业务代码

##### 优点:
普通发送方式完全兼容官方用法,可随时修改配置文件改为其他驱动,而不需要改动业务代码
> `Laravel 5.5` 以下版本请使用 `1.1.3` 版本,并手动添加 ServiceProvier 到 `config/app.php`
## 安装

在项目目录下执行

```
composer require naux/sendcloud
```

## 配置

修改 `config/app.php`,添加服务提供者

```php
'providers' => [
// 添加这行
Naux\Mail\SendCloudServiceProvider::class,
];
```

`.env` 中配置你的密钥, 并修改邮件驱动为 `sendcloud`

```ini
Expand All @@ -36,7 +23,7 @@ SEND_CLOUD_KEY= # 分配的 api_key

## 使用

#### 普通发送
#### 普通方式发送
用法完全和系统自带的一样, 具体请参照官方文档: http://laravel.com/docs/5.1/mail

```php
Expand All @@ -47,10 +34,10 @@ Mail::send('emails.welcome', $data, function ($message) {
});
```

#### 模板发送
#### 模板方式发送
用法和普通发送类似,不过需要将 `body` 设置为 `SendCloudTemplate` 对象

> 使用模板发送不与其他邮件驱动兼容 !!!
> 注意:使用模板发送不与其他邮件驱动兼容
```php
// 模板变量
Expand All @@ -63,9 +50,3 @@ Mail::raw($template, function ($message) {
$message->to('[email protected]')->cc('[email protected]');
});
```

## Sponsors

<a href="https://www.yousails.com">
<img src="https://yousails.com/banners/brand.png" width=350>
</a>
39 changes: 22 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
{
"name": "naux/sendcloud",
"license": "MIT",
"authors": [
{
"name": "NauxLiu",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.6",
"illuminate/support": "^5.5",
"guzzlehttp/guzzle": "^6.2"
},
"autoload": {
"psr-4": {
"Naux\\Mail\\": "src/"
}
"name": "naux/sendcloud",
"license": "MIT",
"authors": [
{
"name": "NauxLiu",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.6",
"illuminate/support": "^5.5",
"guzzlehttp/guzzle": "^6.2"
},
"autoload": {
"psr-4": {
"Naux\\Mail\\": "src/"
}
},
"extra": {
"laravel": {
"providers": ["Naux\\Mail\\SendCloudServiceProvider"]
}
}
}

0 comments on commit 574974f

Please sign in to comment.