-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Laravel package auto discovery
- Loading branch information
Showing
2 changed files
with
27 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -36,7 +23,7 @@ SEND_CLOUD_KEY= # 分配的 api_key | |
|
||
## 使用 | ||
|
||
#### 普通发送: | ||
#### 普通方式发送: | ||
用法完全和系统自带的一样, 具体请参照官方文档: http://laravel.com/docs/5.1/mail | ||
|
||
```php | ||
|
@@ -47,10 +34,10 @@ Mail::send('emails.welcome', $data, function ($message) { | |
}); | ||
``` | ||
|
||
#### 模板发送 | ||
#### 模板方式发送 | ||
用法和普通发送类似,不过需要将 `body` 设置为 `SendCloudTemplate` 对象 | ||
|
||
> 使用模板发送不与其他邮件驱动兼容 !!! | ||
> 注意:使用模板发送不与其他邮件驱动兼容 | ||
```php | ||
// 模板变量 | ||
|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} | ||
} | ||
} |