PHP code example of jeffersongoncalves / laravel-whatsapp-widget

1. Go to this page and download the library: Download jeffersongoncalves/laravel-whatsapp-widget 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/ */

    

jeffersongoncalves / laravel-whatsapp-widget example snippets


@

@

use JeffersonGoncalves\WhatsappWidget\Models\WhatsappAgent;

WhatsappAgent::create([
    'active' => true,
    'name' => 'Customer Support',
    'phone' => '+1234567890',
    'text' => 'Hello! I have a question about your product.',
    'image' => 'path/to/agent-avatar.jpg', // Optional
]);

return [
    // Enable or disable audio notification
    'audio' => true,

    // Play audio notification once per day or on every page load
    'play_audio_daily' => true,

    // Filesystem disk for storing agent images
    'disk' => env('FILESYSTEM_DISK', 'local'),

    // Application URL (used for redirection)
    'url' => env('APP_URL', 'http://localhost'),

    // Application name (displayed in the widget)
    'name' => env('APP_NAME', 'Laravel App'),

    // WhatsApp API key (if needed)
    'key' => env('WHATSAPP_KEY'),
];
bash
php artisan vendor:publish --tag=whatsapp-widget-config
bash
php artisan vendor:publish --tag=whatsapp-widget-migrations
bash
php artisan vendor:publish --tag=whatsapp-widget-assets
bash
php artisan vendor:publish --tag=whatsapp-widget-translations
bash
php artisan migrate