laravel/ui
Legacy Laravel package that adds Bootstrap, Vue, or React frontend scaffolding and simple auth (login/registration) via Artisan (php artisan ui ... --auth). Works with modern Laravel, but Breeze or Jetstream are recommended for new apps.
composer require laravel/ui
php artisan ui bootstrap
php artisan ui vue --auth
php artisan ui react --auth
npm install
npm run dev
php artisan migrate
Scaffold a Vue.js + Bootstrap authentication system:
php artisan ui vue --auth
npm install && npm run dev
php artisan migrate
This generates:
/resources/views/auth/)/resources/js/components/)/vite.config.js)/resources/sass/app.scss)--auth flag to generate login/registration flows.login.blade.php, register.blade.php)Login.vue)/routes/web.php)Auth/LoginController.php)/resources/views/auth/./resources/js/components/./resources/sass/app.scss (import Bootstrap variables, add custom styles)./resources/js/app.js for global JS setup (e.g., Axios defaults, Vue plugins).app.js:
import Welcome from './components/Welcome.vue';
Vue.component('welcome', Welcome);
<welcome></welcome>
alpinejs):
// In AppServiceProvider@boot()
Laravel\Ui\UiCommand::macro('alpinejs', function ($command) {
$command->scaffold([
'vite' => ['@alpinejs/vue' => '^3.0'],
'js' => 'resources/js/app.js',
'views' => ['auth' => 'resources/views/auth'],
]);
});
Run with:
php artisan ui alpinejs
npm run dev # Single build
npm run watch # Auto-reload on changes
npm run build # Optimized assets
vite.config.js for HMR:
export default defineConfig({
server: {
hmr: {
host: 'localhost',
port: 3000,
},
},
});
mix-manifest.json references with Vite’s @vite() directive:
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
webpack.mix.js (if used) to Vite config.Auth/LoginController to add logic (e.g., 2FA):
public function __construct() {
$this->middleware('throttle:5,1')->only('login');
$this->middleware('2fa.verified')->except('show2FAForm');
}
auth()->user() in Blade/Vue:
// Vue example
export default {
data() {
return {
user: @json(auth()->user())
};
},
};
composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
config/cors.php:
'paths' => ['api/*', 'sanctum/csrf-cookie'],
Vite Configuration Conflicts:
@vitejs/plugin-vue conflicts with Laravel 12+.vite.config.js:
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: ['resources/sass/app.scss', 'resources/js/app.js'],
refresh: true,
}),
vue(),
],
});
Bootstrap Version Mismatches:
package.json:
"bootstrap": "^5.3.0",
"popper.js": "^2.11.6"
npm install && npm run dev.Vue/React Component Registration:
app.js for proper imports/registration.Auth Middleware Bypass:
routes/web.php:
Route::post('/logout', [LoginController::class, 'logout'])->middleware('auth');
Vite HMR Not Working:
npm run dev is running.vite.config.js for correct server.hmr settings.Asset Compilation Errors:
npm run dev output for errors.node_modules is intact (npm install if corrupted).npm run dev -- --clear
Vue/React Console Errors:
F12) to inspect JS errors.vue or react not installed).Blade Template Issues:
@dd() to debug variables:
@dd(auth()->user())
Vite Public Path:
/public/build/assets.vite.config.js:
export default defineConfig({
base: '/custom-path/',
});
SASS Variables:
/resources/sass/app.scss:
$primary: #6c63ff;
@import "bootstrap/scss/bootstrap";
Laravel Mix Legacy:
webpack.mix.js to Vite:
// Remove webpack.mix.js entirely; use vite.config.js instead.
Custom Auth Views:
/resources/views/auth/:
/resources/views/auth/
├── login.blade.php
├── register.blade.php
└── verify.blade.php
Dynamic Presets:
UiCommand in a service provider:
// app/Providers/AppServiceProvider.php
public function boot() {
UiCommand::macro('tailwind', function ($command) {
$command->scaffold([
'vite' => ['@tailwindcss/vite' => '^3.0'],
'js' => 'resources/js/app.js',
'css' => 'resources/css/app.css',
]);
});
}
API-First Auth:
web.php.api.php:
Route::post('/login', [LoginController::class, 'login']);
Multi-Frontend Support:
build.manifest to serve multiple entry points:
// vite.config.js
export default defineConfig({
build: {
rollup
How can I help you explore Laravel packages today?