Installation:
composer require viezel/filament-tour
For Filament v3.x, use "^3.0" tag.
Register Plugin:
Add the plugin to your Panel configuration in app/Providers/Filament/AdminPanelProvider.php:
public function panel(Panel $panel): Panel
{
return $panel
->default()
->plugins([
\Viezel\FilamentTour\FilamentTourPlugin::make(),
]);
}
Define a Tour: Create a tour in a service provider or a dedicated class:
use Viezel\FilamentTour\Tour;
Tour::create('welcome_tour')
->title('Welcome to Your Panel')
->steps([
Tour::step()
->target('#widgets')
->popover([
'title' => 'Widgets',
'description' => 'Manage your widgets here.',
]),
// Add more steps as needed
]);
Trigger the Tour: The tour will autostart by default. To disable autostart, configure it in the plugin:
FilamentTourPlugin::make()->autoStart(false);
Use this package to guide new users through your Filament admin panel. For example, highlight key sections like:
Tour Creation:
Tour class.Tour::create() to initialize a tour and chain methods like title(), steps(), and onlyVisibleOnce().Tour::create('admin_tour')
->onlyVisibleOnce(fn() => true) // Only show once
->steps([
Tour::step()->target('#resources-table')->popover(['title' => 'Resources', 'description' => 'View and manage resources here.']),
]);
Dynamic Tours:
Tour::create('admin_dashboard_tour')
->steps(fn() => [
auth()->user()->can('access_dashboard') ? Tour::step()->target('#dashboard-stats') : null,
]);
Integration with Filament Resources/Pages:
Tour::create('create_post_tour')
->onlyVisibleOnce()
->steps([
Tour::step()->target('#title-field')->popover(['title' => 'Post Title', 'description' => 'Enter your post title here.']),
]);
Conditional Tour Activation:
FilamentTourPlugin::make()
->onlyVisibleOnce(fn() => app()->environment('production'))
->autoStart(fn() => auth()->check());
Localization: Localize tour popovers by passing translated strings:
Tour::step()->popover([
'title' => __('filament-tour.steps.title'),
'description' => __('filament-tour.steps.description'),
]);
Styling: Customize the DriverJS appearance by publishing the views and overriding the CSS:
php artisan vendor:publish --tag="filament-tour-views"
Then modify the published Blade files in resources/views/vendor/filament-tour/.
Event Listeners: Listen to tour events (e.g., tour-started, tour-ended) to trigger additional logic:
event(new TourStarted($tour));
Testing: Test tours in a staging environment before deploying to production. Use the onlyVisibleOnce config to control visibility:
FilamentTourPlugin::make()->onlyVisibleOnce(fn() => false); // Disable for testing
CSS Selector Conflicts:
enable_css_selector is set to false (default), DriverJS uses IDs for targeting elements. Ensure your target elements have unique IDs or adjust the config:
'enable_css_selector' => true, // Enable if using CSS selectors
Local Storage Issues:
only_visible_once feature relies on localStorage. If users clear their browser data, they may see the tour again. Handle this gracefully with a fallback:
FilamentTourPlugin::make()->onlyVisibleOnce(fn() => !session()->has('tour_completed'));
Tour Autostart Timing:
document.addEventListener('DOMContentLoaded', function() {
setTimeout(() => {
window.FilamentTour.startTour('welcome_tour');
}, 1000); // Delay for 1 second
});
Plugin Registration Order:
FilamentTourPlugin is registered after other plugins that might modify the DOM, as tours rely on the final state of the page.Performance:
Check Tour Steps:
window.FilamentTour.startTour('tour_name');
Console Logs:
'debug' => true,
Clear Local Storage:
only_visible_once feature, clear your browser’s local storage or use incognito mode.Custom Tour Steps:
Tour class to add custom step types or behaviors:
class CustomTour extends Tour
{
public function customStep(array $options)
{
return $this->steps[] = [
'type' => 'custom',
'options' => $options,
];
}
}
Override Default Views:
php artisan vendor:publish --tag="filament-tour-views"
resources/views/vendor/filament-tour/partials/popover.blade.php.Add Tour Buttons:
document.getElementById('start-tour-button').addEventListener('click', function() {
window.FilamentTour.startTour('tour_name');
});
Integrate with Filament Notifications:
event(new TourEnded($tour));
// Listen for the event and trigger a Filament notification.
Multi-Language Support:
Tour::step()->popover([
'title' => __('filament-tour.steps.welcome.title'),
'description' => __('filament-tour.steps.welcome.description'),
]);
How can I help you explore Laravel packages today?