PHP code example of offline-agency / laravel-aruba-sms
1. Go to this page and download the library: Download offline-agency/laravel-aruba-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.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
offline-agency / laravel-aruba-sms example snippets
use Illuminate\Notifications\Notification;
use OfflineAgency\ArubaSms\ArubaSmsMessage;
class OrderShippedNotification extends Notification
{
public function via($notifiable): array
{
return ['aruba-sms'];
}
public function toArubaSms($notifiable): ArubaSmsMessage
{
return (new ArubaSmsMessage())
->content("Your order #{$this->order->id} has been shipped")
->to($notifiable->phone_number);
}
}
use OfflineAgency\ArubaSms\Notifications\SendSmsNotification;
use Illuminate\Support\Facades\Notification;
// Send to an on-demand notifiable (no User model needed)
Notification::route('aruba-sms', null)
->notify(new SendSmsNotification('Your message', '+393331234567'));
// Or send via a notifiable model
$user->notify(new SendSmsNotification('Your message', '+393331234567'));
use OfflineAgency\ArubaSms\ArubaSmsClient;
use OfflineAgency\ArubaSms\ArubaSmsMessage;
$client = app(ArubaSmsClient::class);
$message = new ArubaSmsMessage('Hello!', '+393331234567');
$response = $client->sendMessage($message);
use OfflineAgency\ArubaSms\Facades\ArubaSms;
use OfflineAgency\ArubaSms\ArubaSmsMessage;
// Send a message
$message = new ArubaSmsMessage('Hello!', '+393331234567');
ArubaSms::sendMessage($message);
// Check remaining credits
$response = ArubaSms::checkSmsStatus();
// Get sending history
$response = ArubaSms::getSmsHistory('20260101000001');
class LegacyNotification extends Notification
{
public string $message = 'Hello';
public string $recipient = '+393331234567';
public string $message_type = 'N';
public function via($notifiable): array
{
return ['aruba-sms'];
}
}