Laravel Gust is a backend agnostic Vue.js authentication frontend for Laravel. Gust can power the registration and authentication features of your Laravel backend when using Laravel Fortify, Breeze or UI.
Gust is powered by Vue.js v3, Vue Router v4, Vuex v4 and Tailwind CSS v2 on the frontend and provides scaffolding to get you started with a basic Vue.js SPA that is compatible with all Laravel backend authentication packages.
Gust uses Laravel Sanctum on the backend to authenticate your SPA regardless of the stack you choose.
You can read more about how to install each stack and the changes they make to your application below.
You can install the package via composer:
composer require y0rdie/laravel-gust --dev
Gust offers a choice of three backend stacks: Fortify, Breeze or UI (for you dinosaurs among us).
The Fortify stack is a good choice if you don't need to customise the backend authentication logic this package provides as this is all handled by the package itself.
php artisan gust:install fortify
Read about the changes this makes to your application in the What the Fortify stack does section below.
The Breeze stack is a good choice if you want greater control over the backend authentication logic this package provides as this is all published into your application.
php artisan gust:install breeze
Read about the changes this makes to your application in the What the Breeze stack does section below.
The UI stack is a good choice if you're already familiar with the backend authentication logic this package provides and not quite ready to make the switch to Breeze or Fortify.
php artisan gust:install ui
Read about the changes this makes to your application in the What the UI stack does section below.
php artisan migrate
npm install && npm run dev
In order for any SPA to be compatible with Laravel, here is an exhaustive list of all the changes required:
laravel/sanctum
package.vendor:publish
command.SANCTUM_STATEFUL_DOMAINS
as an environment variable.app/Http/Kernel.php
.MustVerifyEmail
interface to app/Models/User.php
.routes/api.php
and routes/web.php
stubs.resources/sass
directory.resources/js/bootstrap.js
file.resources/views
directory ready for the new stubs.package.json
to require Vue.js, Vue Router, Vuex and Tailwind CSS.ResetPassword::createUrlUsing
method in app/Providers/AuthServiceProvider.php
as recommended here, due to the GET route definition no longer existing in a SPA.route('login')
with url('login')
in app/Http/Middleware/Authenticate.php
due to the GET route definition no longer existing in a SPA.laravel/fortify
package.vendor:publish
command.FortifyServiceProvider
to the providers key in config/app.php
.config/fortify.php
to set 'views' => false,
and only enable the registration, reset passwords, email verification features.app/Providers/FortifyServiceProvider.php
to only register the CreateNewUser
and ResetUserPassword
actions.app/Actions/Fortify/UpdateUserPassword.php
file.app/Actions/Fortify/UpdateUserProfileInformation.php
file.You can find out more about Laravel Fortify in the official repository.
vendor:publish
command.routes/auth-breeze.php
stubs to routes/auth.php
and require it in routes/web.php
.app/Http/Controllers/Auth/NewPasswordController.php
stub. This ensures a validation exception is thrown for a mismatching token, and also changes route('login')
with to('login')
due to the GET route definition no longer existing in a SPA.app/Views
directory.You can find out more about Laravel Breeze in the official repository.
laravel/ui
package.ui:controllers
command.routes/auth-ui.php
stubs to routes/auth.php
and require it in routes/web.php
.app/Http/Controllers/Auth/LoginController.php
stub. This overrides the logout
method to explicitally use the auth web guard.app/Http/Controllers/HomeController.php
file.You can find out more about Laravel UI in the official repository.
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
*This package might have a catchy one word name just like many other first party Laravel packages, however, this is most definitely an unoffical package and in no way endorsed by the Laravel team. It's more of a tongue-in-cheek reference, but hopefully just as brilliant.