1. Go to this page and download the library: Download akibatech/laravel-ovh-sms library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$client = app('ovhsms');
// Prepare a new SMS instance and return it.
$sms = $client->newMessage('the phone number');
$sms->send('Hi!');
// Same as above but the SMS is marked as a marketing message.
$sms = $client->newMarketingMessage($phone); // Alias of newMessage($phone, true);
$sms->send('Hello!');
// Attach many receivers
$sms = $client->newMessage(['phone1', 'phone2'], ...);
$sms->send('Hi guys!');
// Send directly the message
$client->sendMessage($phone, 'Hello!');
// Or
$client->sendMarketingMessage($phone, 'Super price this sunday!');
// Retrieve OVH SMS instance
$ovhsms = app('ovhsms'); // Or Ovhsms::getClient();// Get available SMS accounts
$accounts = $ovhsms->getAccounts();
// Set the account you will use
$ovhsms->setAccount($accounts[0]);
// Create a new message that will allow the recipient to answer (to FR receipients only)
$sms = $ovh->createMessage(true);
$sms->addReceiver("+33601020304");
$sms->setIsMarketing(false);
// Plan to send it in the future
$sms->setDeliveryDate(new DateTime("2018-02-25 18:40:00"));
$sms->send("Hello world!");
namespaceApp\Notifications;
useAkibatech\Ovhsms\Notifications\OvhSmsChannel;
useAkibatech\Ovhsms\Notifications\OvhSmsMessage;
useIlluminate\Notifications\Notification;
classExampleNotificationextendsNotification{
/**
* Notification via OvhSmsChannel.
*/publicfunctionvia($notifiable){
return [OvhSmsChannel::class];
}
/**
* Your notification must implements "toOvh()"
*/publicfunctiontoOvh($notifiable){
return (new OvhSmsMessage('A new invoice was paid! Amount: $9.00'));
}
}