PHP code example of amarafiif / filament-lost-connection
1. Go to this page and download the library: Download amarafiif/filament-lost-connection 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/ */
amarafiif / filament-lost-connection example snippets
return [
'ping_url' => env('FILAMENT_LOST_CONNECTION_PING_URL', null),
'check_interval' => env('FILAMENT_LOST_CONNECTION_CHECK_INTERVAL', 3000),
'position' => env('FILAMENT_LOST_CONNECTION_POSITION', 'bottom'),
'messages' => [
'lost_connection' => env('FILAMENT_LOST_CONNECTION_MESSAGE', '⚠️ Kamu tidak terhubung ke internet.'),
'connected' => env('FILAMENT_CONNECTED_MESSAGE', '🔌 Koneksi tersambung kembali.'),
],
'colors' => [
'lost_connection' => env('FILAMENT_LOST_CONNECTION_COLOR', '#991b1b'),
'connected' => env('FILAMENT_CONNECTED_COLOR', '#065f46'),
],
'icon' => env('FILAMENT_LOST_CONNECTION_ICON', 'heroicon-o-exclamation-triangle'),
];
namespace App\Providers\Filament;
use Amarafiif\FilamentLostConnection\FilamentLostConnection;
use Filament\Panel;
use Filament\PanelProvider;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
// ... other configurations
->plugins([
FilamentLostConnection::make()
->position('bottom') // 'top' or 'bottom'
->lostConnectionText('⚠️ Connection lost!')
->connectedText('✅ Back online!')
->lostConnectionColor('#dc2626')
->connectedColor('#16a34a')
->checkInterval(5000) // Check every 5 seconds
->pingUrl('https://your-server.example/...') // Custom ping URL
->icon('heroicon-o-wifi'),
]);
}
}
FilamentLostConnection::make()
FilamentLostConnection::make()
->lostConnectionText('📵 No internet connection')
->connectedText('🌐 Connected to internet')
FilamentLostConnection::make()
->position('top')
->lostConnectionColor('#ef4444')
->connectedColor('#10b981')
->icon('heroicon-o-exclamation-circle')
FilamentLostConnection::make()
->pingUrl('https://httpbin.org/status/200')
->checkInterval(2000) // Check every 2 seconds
bash
php artisan vendor:publish --tag="filament-lost-connection-config"
bash
php artisan vendor:publish --tag="filament-lost-connection-views"