Get Started with TourDeck
TourDeck is a self-contained Laravel 12 application that demonstrates every mode laravel-driverjs supports. It lives in its own repository — clone it on its own; you do not need a copy of the package repository.
Prerequisites
- PHP 8.2 or higher
- Composer
Step 1 — Clone the Repository
git clone https://github.com/realrashid/tour-deck.git
cd tour-deckStep 2 — Install Dependencies
composer installThis pulls in Laravel and realrashid/laravel-driverjs.
Working on the package itself?
If you have the laravel-driverjs repository checked out locally and want TourDeck to use it, keep the two side by side and TourDeck's composer.json path repository will symlink your working copy into vendor/:
your-projects/
├── packages/
│ └── laravel-driverjs/
└── tour-deck/Step 3 — Set Up Environment Variables
Copy the example environment file and open it for editing:
cp .env.example .envThe defaults in .env.example work out of the box for local development. Sessions are stored on disk (no database required).
Step 4 — Generate Application Key
php artisan key:generateStep 5 — Start the Server
php artisan serveOpen http://localhost:8000 in your browser.
Step 6 — Explore the Demo
The dashboard includes four interactive tour demonstrations. Click the buttons in the Tour Demonstrations panel to trigger each one.
| Demo | Tour Type | How It Works |
|---|---|---|
| Onboarding Tour | Multi-step tracked tour | Auto-starts on first visit. Tracked via session so it won't repeat. |
| Highlight Stats | Single-element highlight | Manually triggered. Uses highlight() with no navigation buttons. |
| Feature Modal | Centred modal | Manually triggered. Uses modal() with no element target. |
| Confirm-Exit Tour | Tour with exit guard | StepHooks::confirmBeforeDestroy() asks before closing the tour. |
How It Works
Tracked Onboarding Tour — View Composer Pattern
The welcome tour is configured in app/Providers/AppServiceProvider.php using Laravel's View Composer. The composer runs for every request that renders the dashboard view and, if the tour hasn't been completed yet, attaches five steps to the singleton:
use Illuminate\Support\Facades\View;
public function boot(): void
{
View::composer('dashboard', function () {
$driver = app('driverjs');
if (! $driver->tourCompleted('welcome-tour')) {
$driver->tour('welcome-tour')
->showProgress()
->progressText('Step {{current}} of {{total}}')
->step('#dashboard-header', 'Welcome to TourDeck! 👋',
'This demo showcases <strong>laravel-driverjs</strong>.')
->step('#stats-grid', 'Key Metrics',
'Track your essential metrics at a glance.')
->step('#projects-section', 'Projects',
'Monitor all active projects and their current status.')
->step('#activity-feed', 'Activity Feed',
'See recent events in chronological order.', ['side' => 'left'])
->step('#tour-controls', 'Tour Controls',
'Explore all tour types supported by this package!', ['side' => 'top']);
}
});
}In the dashboard.blade.php view, the @driverjsTour directive renders and auto-starts the tour if it has not been completed:
@driverjsTour('welcome-tour')Because the View Composer has already set up the singleton by the time the directive fires, the tour renders with all five steps. After the user finishes, the package marks it as complete in the session — so the next page load skips the tour entirely.
Manually Triggered Tours
Highlight, modal, and confirm-exit tours are triggered by JavaScript functions defined at the bottom of dashboard.blade.php using toJavaScript():
<script>
function triggerHighlight() {
{!! app('driverjs')
->highlight('#stats-grid', 'Key Metrics',
'Your essential dashboard metrics.')
->toJavaScript() !!}
}
function triggerModal() {
{!! app('driverjs')
->modal('Feature Showcase ✨',
'This centered modal uses the <strong>modal()</strong> method.')
->toJavaScript() !!}
}
function triggerConfirmTour() {
{!! app('driverjs')
->tour('confirm-tour')
->onDestroyStarted(
\RealRashid\LaravelDriverJs\Support\StepHooks::confirmBeforeDestroy(
'Exit this guided tour?'
)
)
->step('#settings-section', 'Settings', 'Configure your app preferences here.')
->step('#feature-showcase', 'New Features', 'Explore the latest capabilities.')
->step('#stats-grid', 'Performance', 'Review your key metrics.')
->toJavaScript() !!}
}
</script>Each function is bound to a button's onclick attribute in the Tour Demonstrations panel.
Resetting Tour Completion
A reset button at the top of the dashboard page posts to /reset-all-tours, which calls resetCompletion() on each tracked tour name:
public function resetAllTours(): RedirectResponse
{
foreach (['welcome-tour'] as $tourName) {
app('driverjs')->tour($tourName)->resetCompletion();
}
return redirect()->route('dashboard')
->with('success', 'All tours have been reset.');
}After redirecting back, the View Composer re-attaches the welcome tour steps and @driverjsTour renders it again on the very next page load.