arkecosystem / fortify
Authentication Scaffolding for Laravel. Powered by Laravel Fortify.
Requires
- php: ^8.0
- arkecosystem/ui: ^5.0
- danharrin/livewire-rate-limiting: ^0.3.0
- illuminate/support: ^8.0
- jenssegers/agent: ^2.6
- laravel/fortify: ^1.8
- livewire/livewire: ^2.6
- pragmarx/google2fa-laravel: ^1.3
- spatie/laravel-medialibrary: ^9.7
- spatie/laravel-newsletter: ^4.10
- spatie/laravel-personal-data-export: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- graham-campbell/analyzer: ^3.0
- guzzlehttp/guzzle: ^7.3
- mockery/mockery: ^1.3
- nunomaduro/larastan: ^0.6
- nunomaduro/laravel-mojito: ^0.2
- orchestra/testbench: ^6.9
- pestphp/pest: ^1.0
- pestphp/pest-plugin-faker: ^1.0
- pestphp/pest-plugin-laravel: ^1.0
- pestphp/pest-plugin-livewire: ^1.0
- pestphp/pest-plugin-parallel: ^0.3.1
- phpunit/phpunit: ^9.5
- teamtnt/laravel-scout-tntsearch-driver: ^10.0
This package is auto-updated.
Last update: 2021-10-29 02:14:52 UTC
README
Authentication Scaffolding for Laravel. Powered by Laravel Fortify.
Installation
- Require with composer:
composer require arkecosystem/fortify - Publish all the assets / views with
php artisan vendor:publish --provider="ARKEcosystem\Fortify\FortifyServiceProvider" --tag=config --tag=images. - Disable auto-discovery for all fortify packages. This step is required so that we can control the loading order of
laravel/fortifyandarkecosystem/fortify.
"extra": { "laravel": { "dont-discover": ["arkecosystem/fortify", "laravel/fortify"] } },
- Required Image
Projects require an image to be provided: resources/images/auth/verify-email.svg
This is omitted from fortify to prevent it being overwritten, but allows for it to be customised per project.
In the future, a config file may be a better route if there are multiple instances of images being required.
- Register the service providers in this exact order. This will ensure that our package can overwrite any bindings that
laravel/fortifycreated.
Laravel\Fortify\FortifyServiceProvider::class, ARKEcosystem\Fortify\FortifyServiceProvider::class,
- Enable or disable the login/register with username or email by using the
username_altsetting in theconfig/fortify.phpfile
<?php return [ // ... 'username_alt' => 'username', // Or set that setting to `null` so the user can only login/register with email: // 'username_alt' => null, // ... ];
Note: If you use the username_alt setting, you need to ensure that your users table has that column.
Note: Currently fortify is intended to be used with 'username' => 'email' in your config, as it expect the email property to be set when creating a new user.
- Register databags in your
AppServiceProviderthat are used by the auth pages
use Konceiver\DataBags\DataBag; ... public function boot() { ... $this->registerDataBags(); } private function registerDataBags(): void { DataBag::register('fortify-content', [ 'register' => [ 'pageTitle' => '', 'title' => '', 'description' => '', ], 'login' => [ 'pageTitle' => '', 'title' => '', 'description' => '', // Optional // 'signupLink' => '', ], 'password' => [ 'reset' => [ 'pageTitle' => '', ], 'request' => [ 'pageTitle' => '', ], ], 'verification' => [ 'notice' => [ 'pageTitle' => '', ], 'verify' => [ 'pageTitle' => '', ], 'send' => [ 'pageTitle' => '', ], ], 'two-factor' => [ 'login' => [ 'pageTitle' => '', ], ], ]); }
Two Factor Authentication
Under the hood we use Pragmarx Google2fa-laravel package.
For custom configuration like generating QR-Code using SVG render instead of a default Imagemagick, you can publish the default configuration and adjust it as per your needs.
- Add file download JS to Mix file
.copy('vendor/arkecosystem/ui/resources/assets/js/file-download.js', 'public/js/file-download.js')
- Include file on any page that needs it (e.g. Account Settings)
@push('scripts') <script src="{{ mix('js/file-download.js')}}"></script> @endpush
- Build assets
yarn prod
Required images
Password Confirmation modal
The password confirmation modal requires an image to be added to to the path resources/images/auth/confirm-password.svg for the projects that use it.
