Giter VIP home page Giter VIP logo

mitake-laravel's Introduction

mitake-laravel

Build Status Latest Stable Version Latest Unstable Version composer.lock

This is a simple Laravel service provider for making it easy to access the Mitake PHP SDK in your Laravel and Lumen applications.

Installation

The Mitake service provider can be installed via Composer.

composer require minchao/mitake-laravel

To use the Mitake service provider, you must register the provider when bootstrapping your application.

Laravel

Laravel 5.5 and above

The package will automatically register provider and facade.

Laravel 5.4 and below

Add Mitake\Laravel\MitakeServiceProvider to the providers section of your config/app.php:

    'providers' => [
        // ...
        Mitake\Laravel\MitakeServiceProvider::class,
    ];

Add Mitake facade to the aliases section of your config/app.php:

    'aliases' => [
        // ...
        'Mitake' => Mitake\Laravel\Facade\Mitake::class,
    ];

Or use the facade class directly:

use Mitake\Laravel\Facade\Mitake;

Lumen

Register the Mitake\Laravel\MitakeServiceProvider in your bootstrap/app.php:

    $app->register(Mitake\Laravel\MitakeServiceProvider::class);

Copy the mitake.php config file in to your project:

mkdir config
cp vendor/minchao/mitake-laravel/config/mitake.php config/mitake.php

Configuration

Publish the package configuration using Artisan (Lumen doesn't support).

php artisan vendor:publish --provider="Mitake\Laravel\MitakeServiceProvider"

Then update config/mitake.php with your credentials. Alternatively, you can update your .env file.

MITAKE_USERNAME=username
MITAKE_PASSWORD=password

Usage

To use the Mitake SDK within your app, you need to retrieve it from the service container:

$mitake = app(\Mitake\Client::class);

$message = (new \Mitake\Message\Message())
    ->setDstaddr('0987654321')
    ->setSmbody('Hello, Laravel IoC Container');
$result = $mitake->send($message);

Or, you can use the Mitake facade:

$message = (new \Mitake\Message\Message())
    ->setDstaddr('0987654321')
    ->setSmbody('Hello, Facade');
$result = Mitake::send($message);

License

See the LICENSE file for license rights and limitations (BSD 3-Clause).

mitake-laravel's People

Contributors

minchao avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jackalgo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.