1. Go to this page and download the library: Download smsaero/smsaero_laravel 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/ */
use SmsAero\SmsAeroMessage;
public function __construct(private SmsAeroMessage $sms) {}
$this->sms->send(['number' => '70000000000', 'text' => 'Hello, World!']);
use Illuminate\Notifications\Notification;
use SmsAero\Laravel\Notifications\SmsAeroMessage;
class OrderShipped extends Notification
{
public function via(object $notifiable): array
{
return ['smsaero'];
}
public function toSmsAero(object $notifiable): SmsAeroMessage
{
return SmsAeroMessage::create("Order #{$this->id} shipped")->sign('MyShop');
}
}
public function routeNotificationForSmsAero(): string
{
return $this->phone;
}
class OrderShipped extends Notification implements ShouldQueue
{
use Queueable;
}
use SmsAero\Laravel\Facades\SmsAero;
$fake = SmsAero::fake();
// ... code under test sends SMS ...
$fake->assertSent();
$fake->assertSentTo('70000000000');
$fake->assertSentCount(1);
$fake->assertNothingSent();