PHP code example of homedoctor-es / laravel-instasent

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

    

homedoctor-es / laravel-instasent example snippets


return [
    //other stuff
    'providers' => [
        //other stuff
        \HomedoctorEs\Laravel\Instasent\InstasentServiceProvider::class,
    ];
];

return [
    //other stuff
    'aliases' => [
        //other stuff
        'Instasent' => \HomedoctorEs\Laravel\Instasent\Facades\Instasent::class,
    ];
];

return [
    'api_token' => '', // your account api token
    'default_from' => 'Laravel', // optional name of the sender
    'dry_run' => false, // only for the notification channel, if true, no sms's will be sent
    'throw_exception_on_error' => true // This will throw up the Instasent sdk exception if an exception is thrown by the dispatchService on the InstasentSmsChannel
];

Instasent::clientSms()->sendSms(
    $sender
    , $phone
    , $text
);

/**
 * Get the Instasent / SMS representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return \HomedoctorEs\Laravel\Instasent\Notifications\Messages\InstasentMessage|string
 */
public function toInstasent($notifiable)
{
    return (new InstasentMessage)
                ->content('Your SMS message content');
}

/**
 * Get the notification channels.
 *
 * @param  mixed  $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return [InstasentSmsChannel::class];
}

/**
 * Get the Instasent / SMS representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return \HomedoctorEs\Laravel\Instasent\Notifications\Messages\InstasentMessage|string
 */
public function toInstasent($notifiable)
{
    return (new InstasentMessage)
                ->content('Your SMS message content')
                ->from('Popilio');
}



namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the Instasent channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForInstasent($notification)
    {
        return $this->phone;
    }
}
bash
$ php composer.phar 
bash
$ php artisan vendor:publish --provider='HomedoctorEs\Laravel\Instasent\InstasentServiceProvider'