smsfactor/smsfactor-laravel 问题修复 & 功能扩展

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

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

smsfactor/smsfactor-laravel

最新稳定版本:v1.1.1

Composer 安装命令:

composer require smsfactor/smsfactor-laravel

包简介

Laravel package for SMSFactor API

README 文档

README

The Laravel Service Provider that allows you to use SMSFactor PHP Client library.

In order to use it, make sure to have an account. You can register here. Once your account is created, you need to generate your first API token. You can find the complete documentation of our API here.

Installation

We recommend using Composer to install the PHP client library to your project.

composer require smsfactor/smsfactor-laravel

Laravel 5.5+

If you're using Laravel 5.5 or above, the package will automatically register the SMSFactor provider and facades.

Laravel 5.4 and below

Add SMSFactor\Laravel\SMSFactorServiceProvider to the providers array in your config/app.php:

'providers' => [
    // Other service providers...
    SMSFactor\Laravel\SMSFactorServiceProvider::class,
],

If you want to use the a facade interface, you can use any of them depending on your need:

use SMSFactor\Laravel\Facade\Account;
use SMSFactor\Laravel\Facade\Campaign;
use SMSFactor\Laravel\Facade\ContactList;
use SMSFactor\Laravel\Facade\Message;
use SMSFactor\Laravel\Facade\Webhook;
use SMSFactor\Laravel\Facade\Token;

Or add any alias in your config/app.php:

'aliases' => [
    ...
    'SMSFactor' => SMSFactor\Laravel\Facade\Account::class,
    'SMSFactor' => SMSFactor\Laravel\Facade\Campaign::class,
    'SMSFactor' => SMSFactor\Laravel\Facade\ContactList::class,
    'SMSFactor' => SMSFactor\Laravel\Facade\Message::class,
    'SMSFactor' => SMSFactor\Laravel\Facade\Webhook::class,
    'SMSFactor' => SMSFactor\Laravel\Facade\Token::class,
],

Configuration

You can use artisan vendor:publish to copy the distribution configuration file to your app's config directory:

php artisan vendor:publish

Then update config/smsfactor.php with your token.

Usage

To use the SMSFactor Client Library you can use the facades, or request an instance from the service container:

$response = Message::send([
	'to' => '33600000000',
	'text' => 'Have you ever danced with the devil in the pale moonlight ?'
]);
print_r($response->getJson()); //In case you don't receive your text, printing the API response might be useful

or

$account = app('SMSFactor\Message');
$response = $account->send([
	'to' => '33600000000',
	'text' => 'Have you ever danced with the devil in the pale moonlight ?'
]);
print_r($response->getJson());

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-03