Apps (Coming Soon) 07 / 32
Installation
The installation steps and process for adding the DevDojo Auth package to your app.
This package is compatible with any Laravel application (10.x or greater) and all available starter kits. The guides in this section walk through each starter kit in detail — below are the basic installation steps for most applications.
1. Install the Package
Install the package via composer:
composer require devdojo/auth
2. Publish the Files
Publish the assets, configs, CI workflow, and migrations:
php artisan vendor:publish --tag=auth:assets
php artisan vendor:publish --tag=auth:config
php artisan vendor:publish --tag=auth:ci
php artisan vendor:publish --tag=auth:migrations
3. Run Migrations
Run the database migrations:
php artisan migrate
4. Extend the DevDojo User Model
Your default User model needs the methods that handle 2FA and email verification. To do this, extend the DevDojo User model from your default App\Models\User.php. Add the following import at the top of the file:
use Devdojo\Auth\Models\User as AuthUser;
and extend the AuthUser class:
class User extends AuthUser
Here is what your default User model should look like:
<?php
namespace App\Models;
use Devdojo\Auth\Models\User as AuthUser;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends AuthUser
{
...
}
5. Installation Complete
Now that everything is installed you'll be able to visit the auth setup route at website.test/auth/setup. You'll also have access to all the new Authentication Pages.
Installing in an Existing Application
As long as your application meets the minimum requirements (Laravel 10 or higher), you'll be able to install DevDojo Auth in your existing application. The steps are the same as above. You'll also want to remove your existing authentication from your application to remove duplicate functionality.
It's possible to keep your existing authentication functionality to ensure everything works correctly; however, having multiple authentication paths may confuse your users.