1. Go to this page and download the library: Download sendkuy/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/ */
sendkuy / laravel example snippets
use SendKuy\Laravel\Facades\SendKuy;
$messages = SendKuy::messages()->send([
'channel' => 'whatsapp',
'to' => ['+6281234567890'],
'body' => 'Your order is on its way.',
]);
use Illuminate\Notifications\Notification;
use SendKuy\Laravel\Notifications\SendKuyMessage;
class OrderShipped extends Notification
{
public function via(object $notifiable): array
{
return ['sendkuy'];
}
public function toSendKuy(object $notifiable): SendKuyMessage
{
return SendKuyMessage::whatsapp('Order #1042 is on its way.')
->media('https://example.com/receipts/1042.pdf', 'document');
}
}
public function routeNotificationForSendKuy(Notification $notification): string
{
return $this->phone; // +6281234567890
}
use Illuminate\Contracts\Queue\ShouldQueue;
use SendKuy\Laravel\Events\WebhookReceived;
class HandleSendKuyWebhook implements ShouldQueue
{
public function handle(WebhookReceived $event): void
{
if ($event->type === 'message.received') {
// $event->data is the message
}
}
}
$this->app->instance(\SendKuy\SendKuy::class, new \SendKuy\SendKuy('sk_test_123', ['http_client' => $fakeClient]));