承接 lapix/celmedia-sms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lapix/celmedia-sms

Composer 安装命令:

composer require lapix/celmedia-sms

包简介

Celmedia SMS API SDK

README 文档

README

This repository has the open source PHP SDK that allows you to send SMS from your PHP app.

Installation

This SDK can be installed via composer.

$ composer require lapix/celmedia-sms

Special Characters

The following special characters are removed or replaced:

'á', 'Á', 'é', 'É', 'í', 'Í', 'ó', 'Ó', 'ú', 'Ú', '^', '`', '¬', '‘', '“', '*', '#', 'ª', 'º', '>', '<', 'ü', '[', ']', '¿', '¡', 'ñ', 'Ñ', '{', '}', '\', '/', '|', '&', '~', ';', '½', '¼', '¾'

And those are the respective replacement values:

'a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U', '', '', '', '', '', '', '', 'a', 'o', '', '', 'u', '(', ')', '', '', 'n', 'N', '(', ')', '', '', '', 'Y', '-', ',', '1/2', '1/4', '3/4'

Usage

<?php

use Lapix\Celmedia\Sms\Client;
use Lapix\Celmedia\Sms\SmsSender;
use Lapix\Celmedia\Sms\SmsFactory;
use Lapix\Celmedia\Sms\JsonEncoder;
use Lapix\Celmedia\Sms\SmsSanitizer;
use Lapix\Celmedia\Sms\CelmediaSmsException;

$sanitizer = new SmsSanitizer();
$createSms = new SmsFactory($sanitizer);

$sender = new SmsSender(
    new Client(
        new \GuzzleHttp\Client(),
        'username',
        'password',
        'apiKey'
    ),
    new JsonEncoder()
);

try {
    // Send multiple sms.'Test méssage' is sent as 'Test message'
    $sender->send([$createSms->createSms('Test méssage', '3111111111', '123456')]);
    // or a single
    $sender->sendSingle($createSms->createSms('Test message', '3111111111', ''));
} catch (CelmediaSmsException $exception) {
    // Internal server error
}

Test

Composer is a prerequisite. Run the unit test with the following command

$ php ./vendor/bin/phpunit

Run the integration test like this

$ INTEGRATION_TEST=true CELMEDIA_USER= CELMEDIA_PASSWORD= CELMEDIA_API_KEY= CELMEDIA_TEST_PHONE= php ./vendor/bin/phpunit

TODO

  • Improve the documentation
  • Add test cases
  • Handle the response exceptions

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固