Laravel 8 has a new and very efficient application scaffolding package called Jetstream, many users however do not want to learn a new framework (TailWind CSS). Luckily, the backend of Jetstream has been made available under the name of Fortify. Fortify is a headless authentication backend without any pre-configured frontend templates which is a disadvantage. FortifyUI improves Fortify by adding that missing feature.
This package is a preset for FortifyUI, it brings ready-to-use and beautiful templates for the most important pages which include: login, registration, password reset pages and two factor authentication. In the latest release, avatars and device management are introduced. The templates are based and build on the Tabler.io framework which is build with Bootstrap 5.0.
This preset includes Tabler assets for release 1.0.0-alpha.21.
- Installation
- Update Instructions
- Two Factor Authentication
- Mail Verification
- Password Confirmation
- Update User Profile and Password
To get started please install the package using composer. This command also installs FortifyUI so you shouldn't install it first.
composer require proxeuse/fortify-tabler
Once installed, please run the installer using the following PHP artisan command. The installer will take you through the installation process and ask you some questions.
php artisan tabler:install
Please do not forget to run the php artisan migrate
command after the successfull installation!
You are able to perform certain updates using the built in updater. This updater will try to override certain files which are included in a new release. Please note that changes applied to those files will be discarded and you should make sure your changes are safe.
Firstly, make sure that you update all files from the repository. This can be done by running the following command or by copying the contents of the repository to your /vendor/proxeuse/fortify-tabler/
folder.
composer update
Once succeeded, you should run the built in update command. You're able to choose between a couple of different updates.
php artisan fortify:update
The command above will update all files, it functions the same as the --type=full
command. All of other the options are listed below:
Command | Action |
---|---|
php artisan tabler:update --type=full |
This will override all files originally installed by the installer. |
php artisan tabler:update --type=views |
This will override all views which are used by the installer. |
php artisan tabler:update --type=language |
This will replace the language files with updated ones. |
php artisan tabler:update --type=controllers |
This will update the controllers which are used by the package. |
php artisan tabler:update --type=public |
This will update all public resources, including for example .css and .js files. |
This package features a function for users to force-logout devices from their account. In order for this function to work you'll need to have set the session driver to database. This can be done by chaning the SESSION_DRIVER
variable in the .env
file to database
. A part of the file will look like the one below. In this example the session lifetime is set to 5 days instead of the default 2 hours.
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=7200
For the 2FA to work, you'll need to perform some manual steps. Firstly, uncomment Fortify::twoFactorChallengeView()
from your /app/Providers/FortifyUIServiceProvider.php
file to register the view. Then, go to the fortify.php
config file and make sure Features::twoFactorAuthentication
is uncommented. Next, you'll want to update your User model to include the following:
use Laravel\Fortify\TwoFactorAuthenticatable;
class User extends Authenticatable
{
use HasFactory, Notifiable, TwoFactorAuthenticatable;
...
To enable the email verification feature, you'll need to visit the FortifyUI service provider (/app/Providers/FortifyUIServiceProvider.php
) and uncomment Fortify::verifyEmailView()
, to register the view. Then, go to the fortify.php config file and make sure Features::emailVerification()
is uncommented. Next, you'll want to update your User model to include the following:
use Illuminate\Contracts\Auth\MustVerifyEmail;
class User extends Authenticatable implements MustVerifyEmail
{
...
This allows you to attach the verified middleware to any of your routes.
To enable the password confirmation feature, you'll need to visit the FortifyUI service provider (/app/Providers/FortifyUIServiceProvider.php
) and uncomment Fortify::confirmPasswordView()
, to register the view. This allows you to attach the password.confirm
middleware to any of your routes.
To enable the ability to update user passwords and/or profile information, go to the fortify.php
config file and make sure these features are uncommented:
Features::updateProfileInformation(),
Features::updatePasswords(),
fortify-tabler is open-sourced software licensed under the MIT license.