1. Go to this page and download the library: Download mdestafadilah/sikuwa 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/ */
// Notifikasi yang tidak boleh menggagalkan request pemanggil:
$result = $client->notify($message); // selalu string
// Pengiriman yang kegagalannya harus ditangani:
try {
$client->send($message);
} catch (\Sikuwa\Whatsapp\Exceptions\WhatsappException $e) {
// ...
}
Client::configured(); // mis. ['OpenWA', 'Wuzapi']
$client->provider(); // instance gateway terpilih
$session = $client->checkSession(); // sesi dari konfigurasi
if (! $session->isConnected()) {
echo $session->qrTag(); // <img> QR siap tampil
}
// Buat sesi/instance baru, lalu pindai QR-nya.
$baru = $client->createSession(['name' => 'Notifikasi Sekolah']);
echo $baru->id;
$qr = $client->showQr();
if ($qr->hasQr()) {
echo $qr->qrTag(); // <img src="data:image/png;base64,…" width="260" height="260">
echo $qr->qrImage(); // data URI — untuk atribut src
echo $qr->qrBase64(); // base64 murni — untuk disimpan atau dikirim sebagai JSON
}
$qr = $client->showQr();
if ($qr->isConnected()) {
// Sudah tersambung — tidak ada yang perlu dipindai.
} elseif ($qr->hasQr()) {
echo $qr->qrTag('Scan untuk menyambungkan WhatsApp', 320);
}
$device = $client->createSession(['name' => 'Notifikasi', 'device' => '08123456789']);
// Perangkat baru menerbitkan tokennya sendiri — simpan ke WHATSAPP_TOKEN.
file_put_contents('.env', "WHATSAPP_TOKEN={$device->token}\n", FILE_APPEND);
$client = new Client(['provider' => 'Fonnte'], $mockGuzzleClient);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.