huangdijia/laravel-mxtong

1.1.0 2019-09-20 08:48 UTC

This package is auto-updated.

Last update: 2024-07-05 16:38:59 UTC


README

SMS gateway for Mxtong

Latest Stable Version Total Downloads

Requirements

  • PHP >= 7.0
  • Laravel >= 5.5

Installation

First, install laravel 5.5, and make sure that the database connection settings are correct.

composer require huangdijia/laravel-mxtong

Then run these commands to publish config

php artisan vendor:publish --provider="Huangdijia\Mxtong\MxtongServiceProvider"

Configurations

// config/mxtong.php
    'user_id'  => 'your user_id',
    'account'  => 'your account',
    'password' => 'your password',

Usage

As Facade

use Huangdijia\Mxtong\Facades\Mxtong;

...

if (!Mxtong::send('mobile', 'some message')) {
    echo Mxtong::getError();
    echo Mxtong::getErrno();
} else {
    echo "send success";
}

As Command

php artisan mxtong:send 'mobile' 'some message'
# send success
# or
# error

As Helper

if (!mxtong()->send('mobile', 'some message')) {
    echo mxtong()->getError();
    echo mxtong()->getErrno();
} else {
    echo "send success";
}
if (!$error = mxtong_send('mobile', 'some message')) {
    echo $error;
} else {
    echo "send success";
}

Other

License

laravel-mxtong is licensed under The MIT License (MIT).