1. Go to this page and download the library: Download zapwize/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/ */
zapwize / laravel example snippets
use Zapwize\Laravel\Facades\Zapwize;
$response = Zapwize::sendMessage('1234567890', 'Hello from Laravel!');
use Zapwize\Laravel\Facades\Zapwize;
$media = [
'url' => 'https://example.com/image.jpg',
// or 'base64' => 'data:image/jpeg;base64,...'
];
$options = [
'caption' => 'This is a caption.',
];
$response = Zapwize::sendImage('1234567890', $media, $options);
use Zapwize\Laravel\Facades\Zapwize;
$media = [
'url' => 'https://example.com/video.mp4',
];
$options = [
'caption' => 'This is a video.',
'gif' => false, // Set to true for GIF videos
];
$response = Zapwize::sendVideo('1234567890', $media, $options);
namespace App\Listeners;
use Zapwize\Laravel\Events\MessageReceived;
class ProcessIncomingWhatsAppMessage
{
public function handle(MessageReceived $event)
{
$messageData = $event->message;
// Process the incoming message...
}
}
use Zapwize\Laravel\Facades\Zapwize;
$isWhatsAppNumber = Zapwize::isWhatsAppNumber('1234567890');
use Zapwize\Laravel\Facades\Zapwize;
$serverInfo = Zapwize::getServerInfo();