oliveris/text 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

oliveris/text

Composer 安装命令:

composer require oliveris/text

包简介

Sends text messages to a provider specified.

README 文档

README

Sends text messages to a provider specified.

The default driver is set to Twilio which will expand eventually to pull in other service providers.

Usage

Pull in the composer package by running the command below:

composer require oliveris/text

Import the Text namespace into the class (autoloading)

use Text\Text;

Examples

Environment variables

If the env method is available from your application you can set the env variables, see example below:

// TWILIO SPECIFIC SETTINGS
TWILIO_SID={sid_from_twilio}
TWILIO_TOKEN={token_from_twilio}
// may want to set the inbound number
TWILIO_INBOUND_NUMBER={number_that_captures_inbound_sms}

If the env method is not available, see example below to set them using an alternate method:

$text = Text::getDriver("twilio");
$text->setSid(***********);
$text->setToken(************);
// may want to set the inbound number
$text->setInboundNumber(************);

Sending a SMS

The following example shows how you can send a simple SMS

$text = Text::getDriver("twilio");
$text->setBody('Lorem ipsum dolor sit amet, mnesarchum interpretaris vis eu.');
$text->setTo('+447*********');
$text->setFrom(env('TWILIO_NUMBER'));
$text->send();

Sending a MMS

The following example shows how you can can send a simple MMS

Noticed how this may display differently dependent on device. (iphone/android)

$text = Text::getDriver("twilio");
$text->setBody('Lorem ipsum dolor sit amet, mnesarchum interpretaris vis eu.');
$text->setMedia('url_to_media');
$text->setTo('+447*********');
$text->setFrom(env('TWILIO_NUMBER'));
$text->send();

Getting the inbound SMS

To get all of the inbound texts sent to the number

$text = Text::getDriver("twilio");
$text->setBody('Lorem ipsum dolor sit amet, mnesarchum interpretaris vis eu.');
$text->setTo('+447*********');
$text->setFrom(env('TWILIO_NUMBER'));
$text->send();

Built With

  • PHP 7

Versioning

We use Semantic Versioning 1.0.0, for example v1.0.0.

Authors

  • Sam Oliveri - Software Engineer

License

Text is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固