rhysnhall/laravel-socketlabs-driver
最新稳定版本:1.0.0
Composer 安装命令:
composer require rhysnhall/laravel-socketlabs-driver
包简介
Laravel mail driver for SocketLabs injection API.
README 文档
README
Adds a driver for the SocketLabs Injection API to Laravel's email services.
Requirements
- PHP 7.3 or greater.
- A SocketLabs account with a server ID and API key.
Install
Install the package with composer.
composer require rhysnhall/laravel-socketlabs-driver
Setup
Once you register and set up an account with SocketLabs, you'll be presented with a server ID and an API key. Add both of these to your ENV file.
SOCKET_LABS_API_KEY={your_key}
SOCKET_LABS_SERVER_ID={server_id}
Next, add the SocketLabs credentials to your config\services.php config file.
'socketlabs' => [ 'key' => env('SOCKET_LABS_API_KEY'), 'id' => env('SOCKET_LABS_SERVER_ID') ]
Add the SocketLabs service provider to the config\app.php config file.
'providers' => [ ... Rhysnhall\LaravelSocketLabsDriver\SocketLabsServiceProvider::class ]
The last step is to add the SocketLabs driver to the config\mail.php config file.
'mailers' => [ ... 'socketlabs' => [ 'transport' => 'socketlabs' ] ]
You may also want to set SocketLabs as your default mailer, depending on your setup. You'll need to update the MAIL_MAILER variable in your ENV file.
MAIL_MAILER=socketlabs
Config
You can directly add your config variables to the config\mail.php config file or create a new config file to hold these.
config\mail.php
'mailers' => [ ... 'socketlabs' => [ 'transport' => 'socketlabs', 'retries' => 2, 'timeout' => 120, 'proxy_url' => 'https://example' ] ]
config\socketlabs.php
<?php return [ 'retries' => 2, 'timeout' => 120, 'proxy_url' => 'https://example' ];
Usage
Use the driver as you would any other email driver.
App\Mail\Test
class Test extends Mailable { public function build() { return $this->from('sender@example.com') ->view('emails.html.test') ->text('emails.plain.test') ->attach(storage_path('test_image.png')); } }
Mail::to('recipient@example.com')->send(new \App\Mail\Test);
Contributing
Help improve this package by contributing.
Before opening a pull request, please discuss the proposed changes via Github issue or email.
License
This project is licensed under the MIT License - see the LICENSE file for details
统计信息
- 总下载量: 7.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-29