PHP code example of acidf0x / laracool

1. Go to this page and download the library: Download acidf0x/laracool library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

acidf0x / laracool example snippets


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


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

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


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
  }


CoolSMS::message() // return \Nurigo\Api\Message
CoolSMS::groupMessage() // return \Nurigo\Api\GroupMessage
CoolSMS::image() // \Nurigo\Api\Image
CoolSMS::senderID() // \Nurigo\Api\SenderID
bash
 php artisan vendor:publish --provider=AcidF0x\LaraCool\CoolSMSServiceProvider
config/app.php
config/app.php