nanadjei/mobiforte 问题修复 & 功能扩展

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

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

nanadjei/mobiforte

最新稳定版本:v0.2.0

Composer 安装命令:

composer require nanadjei/mobiforte

包简介

An sms package for mobiforte. http://mobiforte.com

README 文档

README

This package provides a convenient way to send SMS from your Laravel application with mobiforte.com as a service provider.

Installation

Download and install Composer (from http://www.getcomposer.org/download) if you do not have it already installed on your machine.

Method 1:

Require this package:

composer require nanadjei/mobiforte

Method 2:

Require this package:

{
    "require": {
       "nanadjei/mobiforte": "0.2.*"
    }
}

and run this command.

composer update

After updating Composer, add the ServiceProvider to the providers array in config/app.php

Laravel => 5.4

If you're using Laravel 5.5 and above, you can skip this step.

Nanadjei\Mobiforte\Mobiforte\MobiforteServiceProvider::class,

And the facade of the package to the $aliases array.

'MobiforteSms' => Nanadjei\Mobiforte\Facades\MobiforteSms::class

Configuration

Before you can start sending SMS you will need to set your api keys and default sender ID in your .env file. You can find your api key and api secret here https://web.mobiforte.com/developer and publish your config.

php artisan vendor:publish --provider="Nanadjei\Mobiforte\MobiforteServiceProvider"
# In your root directory .env
# Note: Sender ID by default uses your app name (env('APP_NAME')). Sender Id must not exceed 11 characters.
MOBIFORTE_SMS_SENDER_ID=LaravelApp

MOBIFORTE_SMS_CLIENT_ID=YourClientId

MOBIFORTE_SMS_CLIENT_SECRET=YourClientSecrete

Usage

Below is a basic usage guide for sending SMS and checking SMS balance of your Mobiforte account.

# Basically sending sms uses api key set in .env file.
 MobiforteSms::send('02XXXXXXXX', "Hello from the other side.");

# Want to use a different api key?
 MobiforteSms::withFreshApiKeys("fresh_client_id", "fresh_client_secret")
   ->send("02XXXXXXXX", "Say hello from the other side.");

# To customize sender Id,
# NB: sender Id must not be more than 11 characters
MobiforteSms::from('CompanyName')->send('02XXXXXXXX', 'Say hello to a customer');

Schedule When To Send Message

A date and time in Y-m-d H:i:s format. This DateTime should only be added when you want to schedule the message at a given time.

$dateTime = \Carbon\Carbon::now()->addMinutes(30); // format: 2017-05-02 00:59:00
MobiforteSms::schedule('02XXXXXXXX', 'I have responded after 30 mins', $dateTime);

Check SMS balance

This will return your remaining balance.

MobiforteSms::balance();

# To check the balance using an api key different from the one set in the .env file
MobiforteSms::withFreshApiKeys("fresh_client_id", "fresh_client_secret")->balance();

Contributing

Thank you for considering contributing to the package! To contribute, fork this repository, write some code and then submit a pull request to the develop branch 🤝

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-03