1. Go to this page and download the library: Download flickerleap/clickatell 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/ */
flickerleap / clickatell example snippets
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class User extends Model
{
use Notifiable;
/**
* Route notifications for the clickatell channel.
*
* @param \Illuminate\Notifications\Notification $notification
* @return string
*/
public function routeNotificationForClickatell($notification)
{
return $this->mobile;
}
namespace App\Notifications;
use FlickerLeap\Clickatell\ClickatellChannel;
use FlickerLeap\Clickatell\ClickatellMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
class SMSUser extends Notification implements ShouldQueue
{
use Queueable;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [ClickatellChannel::class];
}
/**
* @param $notifiable
* @return \FlickerLeap\Clickatell\ClickatellMessage
*/
public function toClickatell($notifiable)
{
$content = 'My message.';
return (new ClickatellMessage())->content($content);
}
}
/**
* @param $notifiable
* @return \FlickerLeap\Clickatell\ClickatellMessage
*/
public function toClickatell($notifiable)
{
$content = 'My message.';
return (new ClickatellMessage())->to($notifiable->beneficiary_number)
->content($content);
}