PHP code example of alhaji-aki / laravel-textcus

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

    

alhaji-aki / laravel-textcus example snippets


// config/services.php
...
'textcus' => [
    'api_key' => env('TEXTCUS_API_KEY'),
    'sender_id' => env('TEXTCUS_SENDER_ID'),
],
...

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the Textcus channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForTextcus()
    {
        // NOTE: this is because you have to remove the + sign infront of the number in international formt
        return substr($this->mobile, 1);
    }
}

use Illuminate\Notifications\Notification;
use AlhajiAki\Textcus\Messages\TextcusMessage;

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

    public function toTextcus($notifiable)
    {
        return (new TextcusMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}