craftcodery/clicksend
Composer 安装命令:
composer require craftcodery/clicksend
包简介
ClickSend integration for Laravel
关键字:
README 文档
README
This package makes it easy to send letters and postcards via ClickSend for your Laravel app.
Installation
You can install the package via composer:
composer require craftcodery/clicksend
Preparing the database
You must publish and run migrations:
php artisan vendor:publish --provider="CraftCodery\ClickSend\ClickSendServiceProvider" --tag="migrations" php artisan migrate
Publishing the config file
You can publish the config file with:
php artisan vendor:publish --provider="CraftCodery\ClickSend\ClickSendServiceProvider" --tag="config"
Publishing the config allows you to customize the environment variables used for setting your ClickSend username and API key.
Configuring for usage
Start by setting environment variables for your ClickSend username and API Key. By default the package looks for CLICKSEND_USERNAME and CLICKSEND_KEY.
Any models that you want to be able to receive mailers need to use CraftCodery\ClickSend\Traits\CanReceiveMailers. This trait only requires one method, mailerRecipientAddress, which returns an array of formatted address information. An example of the required array structure is below.
/** * Get the recipient's address for ClickSend mailers. * * @return array */ public function mailerRecipientAddress() { return [ 'address_name' => $this->name, 'address_line_1' => $this->address, 'address_line_2' => $this->address_2, 'address_city' => $this->city, 'address_state' => $this->state, 'address_postal_code' => $this->postal_code, 'address_country' => $this->country, ]; }
Similarly, any models that you want to be able to send mailers need to use CraftCodery\ClickSend\Traits\CanSendMailers. This trait only requires the method mailerReturnAddress, which returns an array of formatted return address information. An example of the required array structure is below.
/** * Get the sender's return address for ClickSend mailers. * * @return array */ public function mailerReturnAddress() { return [ 'address_name' => $this->name, 'address_line_1' => $this->address, 'address_line_2' => $this->address_2, 'address_city' => $this->city, 'address_state' => $this->state, 'address_postal_code' => $this->postal_code, 'address_country' => $this->country, ]; }
Sending items
The sendLetterTo and sentPostcardTo methods are available to any models using the CanSendMailers trait.
Each method requires a recipient model (that uses the CanReceiveMailers trait) as the first parameter. Letters require the content as the second parameter, while postcards require a PDF URL for the second parameter, and the content for the third parameter.
The PDF used as the second parameter in the postcard method will be sent on the front of the postcard. The content will be sent on the rear.
$user->sendLetterTo($recipient, 'This is the content of the letter.'); $user->sendPostcardTo($recipient, 'https://example.com/postcard-image.pdf', 'This is the content on the rear of the postcard.');
License
The MIT License (MIT). Please see License File for more information.
craftcodery/clicksend 适用场景与选型建议
craftcodery/clicksend 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 1.72k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 01 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ClickSend」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 craftcodery/clicksend 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 craftcodery/clicksend 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 craftcodery/clicksend 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
ClickSend Notifications channel for Laravel 5.8+
ClickSend Notifications channel for Laravel 5.1+
ClickSend Notifications channel for Laravel 5.1+
ClickSend Notifications channel for Laravel 9
PHP class for sms gateways, using same codebase implementaion to send sms in different sms gateways.
ClickSend Notifications channel for Laravel 5.6 & 6.* - forked from vladski/laravel-sms-clicksend
统计信息
- 总下载量: 1.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-05