bertoost / craft-messagebird
为Messagebird消息功能提供Craft CMS插件。
v2.1.0
2024-05-20 08:00 UTC
Requires
- php: ^8.0 || ^8.1
- craftcms/cms: ^4.1 || ^5.0
- messagebird/php-rest-api: ^v3.1
This package is auto-updated.
Last update: 2024-09-20 08:45:16 UTC
README
Messagebird for Craft CMS
此插件为Messagebird提供Craft CMS集成。
支持
- 短信功能
以下服务正在开发中
- 语音功能
- 报告功能(在控制面板中查看)
要求
此插件需要Craft CMS 3.1.5或更高版本。
安装
您可以从插件商店或使用Composer安装此插件。
从插件商店
转到项目的控制面板中的插件商店,搜索“Messagebird”,然后在其模态窗口中点击“安装”按钮。
使用Composer
打开您的终端并运行以下命令
# go to the project directory cd /path/to/my-project.test # tell Composer to load the plugin composer require bertoost/craft-messagebird # tell Craft to install the plugin ./craft install/plugin messagebird
设置
Messagebird安装完成后,转到设置 → Messagebird,并输入您的API密钥和短信发起者名称(最多11个字符)。输入您的Messagebird API密钥(您可以从dashboard.messagebird.com/en-us/developers/access获取),然后点击保存。
提示:API密钥设置可以设置为环境变量。有关更多信息,请参阅Craft文档中的环境配置。
使用方法
很简单,让我们用一个例子来说明;
// Use the plugin use bertoost\messagebird\Plugin; // Send a SMS Plugin::getInstance()->getSms() // required: add at least one recipient & body ->addRecipient('+31600000000') ->setBody('This is a test') // optional: reference ->setReference('Testing SMS') // optional: schedule time ->setSchedule((new \DateTime())->modify('+5 minutes')) // send it ->send();