andreaslyngholm/inmobile-sms-api

PHP 用于与 Inmobile SMS API 交互的包装器

v2.2 2021-10-15 14:20 UTC

This package is auto-updated.

Last update: 2024-09-15 21:23:41 UTC


README

Inmobile SMS API 客户端库可用于与 Inmobile API 交互。

安装

使用 composer 安装此包

composer require andreaslyngholm/inmobile-sms-api

基本用法

<?php

use Inmobile\Text;
use Inmobile\Gateway;
use Inmobile\Message;
use Inmobile\Recipient;

$gateway = Gateway::create('apiKey');

$message = Message::create('Hello world!')->from('My App')->to('4512345678');

$gateway->addMessage($message);
$gateway->send();


// Other capabilities:
$text = (new Text('Hello World'))->flash()->encoding('utf-8');

$recipients = [
    (new Recipient('4512345678'))->withMessageId('my-id'),
    '450000000'
];

Message::create($text)->to($recipients)->from('My App')->doNotRespectBlacklist()->scheduleAt(date_create('+1 hour'));