didiroesmana/phalcon-sms-service

v1.0.2 2016-12-16 10:58 UTC

This package is not auto-updated.

Last update: 2025-04-26 23:36:48 UTC


README

Service Adapter for Multiple SMS Service such as Nexmo , Clickatell.

TO DO

  • Add Nexmo
  • Add Clickatell
  • Clickatell batch send
  • Changeable SMS Provider
  • Error Handling
  • Unit Test

How To

  • add this to your config

    	'smsService' => [
    		'use' => 'Nexmo',
    		'Nexmo' => [
    	    		'api_key' => env('NEXMO_API_KEY','YOUR NEXMO API KEY'),
    	    		'api_secret' => env('NEXMO_API_SECRET','API_SECRET'),
    	    		'endpoint' => 'https://rest.nexmo.com/sms/json',
    		],
    		'Clickatell' => [
                'token' => env('CLICKATELL_TOKEN', 'YOUR CLICKATELL TOKEN'),
                'endpoint' => 'https://platform.clickatell.com/messages',
            ],
    	],
  • add Sms service to your DI ,

    	$di->setShared('sms', \Didiroesmana\SMSService\Service::class);
  • Send SMS

    • get sms service from DI

    • and send it

       	// first parameter is sender
       	// second is the recipient number
       	// third is the message
       	dump($this->sms->send('DDGEMES','69696969696969','ANU DD GEMESH'));
  • Providers

    • Nexmo
    • Clickatell
      • to send batch sms , create array of number and put it in second arguments.
               dump($this->sms->send('DDGEMES',['+62xxxx','+62xxxxx','+1xxxxxx' ...]));
  • Change Provider

$this->sms->changeProvider('Clickatell')->send(...);