PHP code example of macellan / ileti-merkezi

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

    

macellan / ileti-merkezi example snippets


// config/services.php
...
    'sms' => [ 
        'iletimerkezi' => [
            'key' => env('ILETIMERKEZI_KEY'),
            'hash' => env('ILETIMERKEZI_HASH'),
            'origin' => env('ILETIMERKEZI_ORIGIN'), // sender title
            'enable' => env('ILETIMERKEZI_ENABLE', true),
            'debug' => env('ILETIMERKEZI_DEBUG', false), // will log sending attempts and results
            'sandboxMode' => env('ILETIMERKEZI_SANDBOX_MODE', false) // will not invoke API call
        ],
    ],
...

use Illuminate\Notifications\Notification;
use Macellan\IletiMerkezi\IletiMerkeziMessage;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return ['iletimerkezi'];
    }

    public function toIletiMerkezi($notifiable)
    {
        return IletiMerkeziMessage::create()
            ->setBody('Your account was approved!')
            ->setSendTime(now());  
    }
}

public function routeNotificationForSms()
{
    return str_replace(['+', ' '], '', $this->phone);
}

Notification::route('sms', '905322234433')  
            ->notify(new AccountApproved());