eeappdev/

svevesms

Sveve SMS API 处理器

0.0.3 2023-05-01 15:49 UTC

This package is auto-updated.

Last update: 2024-09-30 01:35:51 UTC


README

Latest Version on Packagist Total Downloads

用于通过 Sveve API 发送 SMS

// Send an SMS thru the API
use Eeappdev\SveveSms\Sms;
$sms = new Sms();
$sms->to($phonenumber)
    ->message('Content of the message')
    ->send();

安装

您可以通过 composer 安装此包

composer require eeappdev/svevesms

如果需要,发布配置

php artisan vendor:publish --provider="Eeappdev\SveveSms\SmsServiceProvider" --tag="config"

在您的 .env 文件中添加凭据

SVEVE_USER=
SVEVE_PASSWORD=
SVEVE_URL="https://sveve.no/SMS/"
SVEVE_FROM=

使用方法

use Eeappdev\SveveSms;

$sms = new Sms();

$sms->to($phonenumber)
    ->from() // set from, if not set, it will come from config
    ->message() // Write your message
    ->test(true) // Will not send the SMS
    ->send(); // Sending the request

向多个收件人发送相同的信息

$sms = new Sms();
$sms->to([
        '12345678', 
        '23456789'
    ])
    ->message('This message will be sent to both recipients') // Write your message
    ->send(); // Sending the request

向多个收件人发送相同的信息

$sms = new Sms();
$sms->to(12345678)
    ->to(23456789)
    ->message('This message will be sent to both recipients')
    ->send(); // Sending the request

向不同的收件人发送不同的信息

$sms = new Sms();
$sms->to(12345678)
    ->message('This message will be sent to first recipient')
    ->to(23456789)
    ->message('This message will be sent to second recipient')
    ->send(); // Sending the request

检查剩余的 SMS

$sms = new Sms();
$sms->remainingSms(); // Return null or int

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件