PHP code example of victorybiz / unified-sms

1. Go to this page and download the library: Download victorybiz/unified-sms 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/ */

    

victorybiz / unified-sms example snippets


'providers' => [

    Victorybiz\UnifiedSMS\UnifiedSMSServiceProvider::class,

]

'aliases' => [

	'UnifiedSMS' => Victorybiz\UnifiedSMS\Facades\UnifiedSMSFacade::class,

]

php artisan vendor:publish --tag=unified-sms

use UnifiedSMS;

$msg = [
			'from' => 'Your sender ID here', // default_sender_id set in config file will be used if this line is removed or comment out
			'to' => 'The recipent mobile number, international format without the leading plus (+)',
			'text' => 'Your text message here.',
	   ];
$response = UnifiedSMS::sendSMS($msg);




$unified_sms_config = [
    /*
    |--------------------------------------------------------------------------
    | Default SMS driver
    |--------------------------------------------------------------------------
    | This option controls the default SMS driver to use.
    |
    | Supported: "null", "routemobile", "nexmo", "moreify", "betasms", "multitexter"
    */
    'default_sms_driver' => 'null',
	
	/*
    |--------------------------------------------------------------------------
    | Default VOICE SMS driver
    |--------------------------------------------------------------------------
    | This option controls the default Voice SMS driver to use.
    |
    | Supported: "null"
    */
    'default_voice_sms_driver' => 'null',
	
    /*
    |--------------------------------------------------------------------------
    | Drivers
    |--------------------------------------------------------------------------
    | Here you can define the settings for each driver. 
    */
    'drivers' => [
		'null' => [
			'sms' => [
				'default_sender_id' => 'Null',
				'api_key' => 'null'
			],
			'voice' => [
				'default_caller_id' => '+1000',
				'api_key' => 'null',
			],            
		],
		'routemobile' => [
			'sms' => [
				'default_sender_id' => 'INFO',
				'server' => '',
				'port' => '8080',
				'username' => '',
				'password' => '',
			],          
		],
		'nexmo' => [
			'sms' => [
				'default_sender_id' => 'INFO',
				'api_key' => '',
				'api_secret' => '',
				'callback_url' => null, // The webhook endpoint the delivery receipt for this sms is sent to. 
									// If set, it overrides the webhook endpoint you set in Dashboard 
			], 
		],
		'moreify' => [
			'sms' => [
				'project' => '',
				'password' => '',
			], 
		],
		'betasms' => [
			'sms' => [
				'default_sender_id' => 'INFO',
				'username' => '',
				'password' => '',
			], 
		],
		'multitexter' => [
			'sms' => [
				'default_sender_id' => 'INFO',
				'email' => '',
				'password' => '',
				'force_dnd' => true,
			], 
        ],
	],
];



use Victorybiz\UnifiedSMS\UnifiedSMS;

$unifiedSMS = new UnifiedSMS($unified_sms_config); 

$unifiedSMS = new \Victorybiz\UnifiedSMS\UnifiedSMS($unified_sms_config);

$msg = [
			'from' => 'Your sender ID here', // default_sender_id set in config file will be used if this line is removed or comment out
			'to' => 'The recipent mobile number, international format without the leading plus (+)',
			'text' => 'Your text message here.',
	   ];
$response = $unifiedSMS->sendSMS($msg);

200				Success
1001			Invalid URL or Missing Params
1002			Invalid credentials
1003			Invalid recipient
1004			Invalid sender
1005			Invalid message
1006			Invalid message type
1007			Invalid delivery
1008			Insufficient credit
1009			Response timeout
1010			Internal error
1011			Account Suspended