通过多个网关发送短信的Composer库

1.0.5 2023-10-20 11:39 UTC

This package is auto-updated.

Last update: 2024-09-20 13:38:49 UTC


README

根Composer库,通过主机如AWS SNS或OVH发送短信

设置说明

要安装net-tools/sms包,只需通过composer要求: require net-tools/sms:^1.0.0

别忘了添加真实实现: require net-tools/sms-aws:^1.0.0require net-tools/sms-ovh:^1.0.0

如何使用?

此项目使您可以通过AWS SNS或OVH提供商发送短信

// create the $snsclient ; please refer to AWS API reference to see how to create the client

// creating config ; actual parameters vary along providers
$config = new \Nettools\Core\Misc\ObjectConfig((object)['sanitizeSenderId' => true]);

// create the api gateway
$gw = new Aws\ApiGateway($snsclient, $config);


// send a sms to several recipients, and this is a transactionnal message (last parameter set to True)
$gw->send('Appointment confirmed !', 'CLINIC', ['+XXYYYYYYYYY', '+XXZZZZZZZZZZ'], true);


// if there are many recipients, call bulkSend insted, with same parameters, as it's more optimized

支持的API是:AWS和OVH。

PHPUnit

要使用PHPUnit进行测试,请将-c配置选项指向/phpunit.xml配置文件。