PHP code example of saleemepoch / txtnation

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

    

saleemepoch / txtnation example snippets


php artisan vendor:publish

return [
	/* REQUIRED */
	'username' => '',
	'ekey' => '',
	// also known as sender id.
	'title' => '',

	/* OPTIONAL */
	// if set, requests to txtNation will also consists of the supplied shortcode
	'shortcode' => '',

	// 		'BILL1' => 1.00
	]
];

'keywords' => [
		'BILL10' => 10.00,
		'BILL5' => 5.00,
		'BILL1' => 1.00
	]

public function response(Request $request) {
    
    if ($request->action == 'mpush_ir_message' &&
        (isset($request->billing) && $request->billing == 'MT')) {
         
        $keywords = config('txtNation.keywords');
        
        $message = new SMSMessage;
        $result = $message->msisdn($request->number)
        ->reply(1)
        ->body('Thank you for your business')
        ->id($request->id)
        ->network($request->network)
        ->currency('GBP')
        ->value($keywords[$request->message])
        ->send();
    
    }

}