roundly-consulting / onboarding-for-laravel
Define and track multiple onboarding flows for your Laravel application.
Package info
github.com/roundly-consulting/onboarding-for-laravel
pkg:composer/roundly-consulting/onboarding-for-laravel
Fund package maintenance!
Requires
- php: ^8.4
- illuminate/contracts: ^12.0|^13.0
- roundly-consulting/package-toolkit-for-laravel: ^1.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- roundly-consulting/testing-for-laravel: ^1.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Onboarding for Laravel
Describe onboarding as flows of ordered steps and derive each user's progress on the fly from the data you already have — no tables, nothing to persist. Ask a model for its flow to get the next step, the completion percentage and a JSON-ready array for your frontend, and keep unfinished users on their current step with one middleware.
Installation
Requires PHP 8.4, Laravel 12 or 13.
composer require roundly-consulting/onboarding-for-laravel
Usage
Register a flow once, in a service provider's boot():
use App\Models\User; use RoundlyConsulting\Onboarding\Facades\Onboarding; use RoundlyConsulting\Onboarding\Flow; use RoundlyConsulting\Onboarding\Step; Onboarding::register(Flow::make('Profile Onboarding')->of([ Step::make('Verify email')->route('verification.notice')->completeWhenFilled('email_verified_at'), Step::make('Upload photo')->cta('Upload now')->route('profile.photo')->completeWhenFilled('avatar_path'), Step::make('Add a bio')->optional()->completeIf(fn (?User $user) => filled($user?->bio)), ]));
Add GetsOnboarded to the model and read its progress:
use RoundlyConsulting\Onboarding\Traits\GetsOnboarded; class User extends Authenticatable { use GetsOnboarded; } $user->onboardingProgress(); // 33.33 $user->nextOnboardingStep()?->title; // "Upload photo" Onboarding::for($user)?->toArray(); // title, percentage, next step, every step
Send users who haven't finished to their current step:
Route::middleware(['auth', 'onboarding'])->group(function () { Route::get('/dashboard', DashboardController::class); });
Documentation
The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/onboarding-for-laravel
Release notes are in CHANGELOG.md. To contribute, see the contributing guide.
Support our work
This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.
License
The MIT License (MIT). Please see License File for more information.