1. Go to this page and download the library: Download kstmostofa/laravel-whatsapp 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/ */
kstmostofa / laravel-whatsapp example snippets
use Kstmostofa\LaravelWhatsApp\Facades\WhatsApp;
use Kstmostofa\LaravelWhatsApp\Jobs\SendMessage;
// One-line send — picks backend by recipient shape
WhatsApp::send('+9665XXXXXXXX', 'Hello from Laravel'); // → Cloud API
WhatsApp::send('[email protected]', 'Hello via personal number'); // → Web sidecar
// Templated business message (Cloud API)
WhatsApp::messages()->sendTemplate('+9665XXXXXXXX', 'order_ready', 'en_US', [
['type' => 'body', 'parameters' => [['type' => 'text', 'text' => 'Munir']]],
]);
// Personal-number flow (Web sidecar — works for any chat your paired phone can see)
WhatsApp::web('main')->groups()->create('Project X', ['[email protected]']);
WhatsApp::web('main')->messages()->sendImage('[email protected]', ['url' => 'https://…/photo.jpg', 'caption' => 'Hi']);
// Or queue it
SendMessage::dispatch('+9665XXXXXXXX', 'Queued hello');
// Inbound — listen via Laravel events
Event::listen(\Kstmostofa\LaravelWhatsApp\Events\Web\MessageReceived::class, function ($event) {
Log::info('Got message', ['from' => $event->from(), 'body' => $event->body()]);
});