Giter Club home page Giter Club logo

cool-sms-laravel's Introduction

Cool SMS Laravel

CoolSMS PHP SDK Wrapper for Laravel

Installation

install using composer:

 composer require acidf0x/laracool

Then publish the package configuration using Artisan:

 php artisan vendor:publish --provider=AcidF0x\LaraCool\CoolSMSServiceProvider

Update your settings in the generated app/config/coolsms.php configuration file.

return [
    // api_key and api_secret can be obtained from coolsms.co.kr
    'api' => [
        'key' => 'YOUR_API_KEY',
        'secret' => 'YOUR_API_SECRET',
    ],
];

The AcidF0x\LaraCool\CoolSMSServiceProvider is auto-discovered and registered by default, but if you want to register it yourself: Add the ServiceProvider in config/app.php

'providers' => [
    ...
    ...
    AcidF0x\LaraCool\CoolSMSServiceProvider::class,
]

The CoolSMS facade is also auto-discovered, but if you want to add it manually: Add the Facade in config/app.php

'aliases' => [
    ...
    'CoolSMS' => AcidF0x\LaraCool\Facades\CoolSMS::class,
]

Basic Usage

use AcidF0x\LaraCool\Facades\CoolSMS;
use Nurigo\Exceptions\CoolsmsException;

  try {
      // 4 options(to, from, type, text) are mandatory. must be filled
      $options = new \stdClass();
      $options->to = '01000000000';
      $options->from = '0100000000';
      $options->type = 'SMS';
      $options->text = 'text';
      $result = CoolSMS::message()->send($options);
      dump($result);
  } catch (CoolsmsException $e) {
      dump($e->getMessage()); // get error message
      dump($e->getResponseCode()); // get 'api.coolsms.co.kr' response code
  }

See Detail CoolSMS SDK Example

CoolSMS::message() // return \Nurigo\Api\Message
CoolSMS::groupMessage() // return \Nurigo\Api\GroupMessage
CoolSMS::image() // \Nurigo\Api\Image
CoolSMS::senderID() // \Nurigo\Api\SenderID

Requirements

  • Laravel 5.*
  • PHP 5.5 or greater
  • Composer
  • PHP CURL extension
  • PHP JSON extension

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.