PHP code example of carropublic / notifications

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

    

carropublic / notifications example snippets

bash
php artisan vendor:publish --provider="CarroPublic\Notifications\NotificationServiceProvider"

class Contact extends Model {

    use Notifiable;
    
    // Phone number to receive
    public function routeNotificationForSms()
    {
        return $this->phone;
    }
    
    // Phone number to receive
    public function routeNotificationForWhatsapp()
    {
        return $this->phone;
    }
}

Sender::registerSandboxValidator(function () {
    return !is_production();
});

LaravelTwilioSender::registerValidPhoneForSandbox(function ($to, $type) {
    switch ($type) {
        case LineSender::class:
            return true;
        case TwilioSender::class:
            return false;
    }
}