PHPackages                             calebporzio/onboard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. calebporzio/onboard

Abandoned → [spatie/laravel-onboard](/?search=spatie%2Flaravel-onboard)ArchivedLibrary

calebporzio/onboard
===================

Track onboarding steps for users when they get setup in your app.

v1.7(5y ago)43673.9k↓100%45MITPHP

Since Jan 14Pushed 3y ago7 watchersCompare

[ Source](https://github.com/calebporzio/onboard)[ Packagist](https://packagist.org/packages/calebporzio/onboard)[ RSS](/packages/calebporzio-onboard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (2)Versions (11)Used By (0)

Note: This package has been archived, you should use it's successor "Laravel Onboard" instead:
------------------------------------------------------------------------------------------------------------------------------------------

[](#note-this-package-has-been-archived-you-should-use-its-successor-laravel-onboard-instead-httpsgithubcomspatielaravel-onboard)

---

[![](https://raw.githubusercontent.com/calebporzio/onboard/master/onboard-logo.png)](https://raw.githubusercontent.com/calebporzio/onboard/master/onboard-logo.png)

Onboard
=======

[](#onboard)

A Laravel package to help track user onboarding steps.

Installation:
-------------

[](#installation)

- Install the package via composer

```
composer require calebporzio/onboard
```

- Register the Service Provider and Facade in `config/app.php`

```
'providers' => [
    ...
    Calebporzio\Onboard\OnboardServiceProvider::class,

'aliases' => [
    ...
    Calebporzio\Onboard\OnboardFacade::class,
```

- Add the `Calebporzio\Onboard\GetsOnboarded` trait to your app's User model

```
class User extends Model
{
    use \Calebporzio\Onboard\GetsOnboarded;
    ...
```

Example Configuration:
----------------------

[](#example-configuration)

Configure your steps in your `App\Providers\AppServiceProvider.php`

```
use App\User;
use Calebporzio\Onboard\OnboardFacade;

class AppServiceProvider extends ServiceProvider
{
    // ...

    public function boot()
    {
	    OnboardFacade::addStep('Complete Profile')
	    	->link('/profile')
	    	->cta('Complete')
	    	->completeIf(function (User $user) {
	    		return $user->profile->isComplete();
	    	});

	    OnboardFacade::addStep('Create Your First Post')
	    	->link('/post/create')
	    	->cta('Create Post')
	    	->completeIf(function (User $user) {
	    		return $user->posts->count() > 0;
	    	});
```

Usage:
------

[](#usage)

Now you can access these steps along with their state wherever you like. Here is an example blade template:

```
@if (auth()->user()->onboarding()->inProgress())

		@foreach (auth()->user()->onboarding()->steps as $step)

				@if($step->complete())

					{{ $loop->iteration }}. {{ $step->title }}
				@else

					{{ $loop->iteration }}. {{ $step->title }}
				@endif

			complete() ? 'disabled' : '' }}>
				{{ $step->cta }}

		@endforeach

@endif
```

Check out all the available features below:

```
$onboarding = Auth::user()->onboarding();

$onboarding->inProgress();

$onboarding->finished();

$onboarding->steps()->each(function($step) {
	$step->title;
	$step->cta;
	$step->link;
	$step->complete();
	$step->incomplete();
});
```

Definining custom attributes and accessing them:

```
// Defining the attributes
OnboardFacade::addStep('Step w/ custom attributes')
	->attributes([
		'name' => 'Waldo',
		'shirt_color' => 'Red & White',
	]);

// Accessing them
$step->name;
$step->shirt_color;
```

Example middleware
------------------

[](#example-middleware)

If you want to ensure that your user is redirected to the next unfinished onboarding step, whenever they access your web application, you can use the following middleware as a starting point:

```
