PHP code example of alhelwany / laravel-mtn

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

    

alhelwany / laravel-mtn example snippets


return [
    'url' => env('MTN_GATEWAY_URL', 'https://services.mtnsyr.com:7443/General/MTNSERVICES/ConcatenatedSender.aspx'),
    'username' => env('MTN_USERNAME', null),
    'password' => env('MTN_PASSWORD', null),
    'from' => env('MTN_FROM', null),
];

use Alhelwany\LaravelMtn\Enums\Lang;
use Alhelwany\LaravelMtn\Interfaces\MTNNotification;
use Illuminate\Notifications\Notification;
use Alhelwany\LaravelMtn\Channels\MTNChannel;

class MyNotification extends Notification implements MTNNotification
{
	
    public function via(object $notifiable): array
    {
        return [MTNChannel::class];
    }
    public function toText(): string
    {
        return "Hello";
    }
    public function getLang(): Lang
    {
        return Lang::EN;
    }
}

use Illuminate\Database\Eloquent\Model;
use Alhelwany\LaravelMtn\Interfaces\MTNNotifiable;

class User extends Model implements MTNNotifiable
{
    public function getPhone(): string
    {
        return $this->phone;
    }
}

$user->notify(new MyNotification);
bash
php artisan vendor:publish --tag="mtn-config"