Convert Figma logo to code with AI

laravel logoui

Laravel UI utilities and presets.

2,514
470
2,514
0

Top Related Projects

22,155

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

6,204

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.

27,910

A rugged, minimal framework for composing JavaScript behavior in your markup.

17,515

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.

A set of renderless components to utilise in your Laravel Blade views.

Associate files with Eloquent models

Quick Overview

Laravel UI is an official package for Laravel that provides frontend scaffolding for authentication views and routes. It offers a quick way to set up basic authentication functionality in Laravel applications, including login, registration, and password reset features.

Pros

  • Easy and rapid setup of authentication scaffolding
  • Integrates seamlessly with Laravel's authentication system
  • Provides customizable views for authentication pages
  • Supports multiple CSS frameworks (Bootstrap, Vue, React)

Cons

  • Limited to basic authentication features
  • May require additional customization for complex authentication needs
  • Dependency on specific frontend frameworks
  • Not as flexible as building authentication from scratch

Code Examples

  1. Installing Laravel UI:
composer require laravel/ui
  1. Generating basic authentication scaffolding:
php artisan ui bootstrap --auth
  1. Customizing the login view:
// resources/views/auth/login.blade.php
@extends('layouts.app')

@section('content')
<div class="container">
    <h2>Custom Login Form</h2>
    <form method="POST" action="{{ route('login') }}">
        @csrf
        <div class="form-group">
            <label for="email">Email</label>
            <input type="email" name="email" class="form-control" required>
        </div>
        <div class="form-group">
            <label for="password">Password</label>
            <input type="password" name="password" class="form-control" required>
        </div>
        <button type="submit" class="btn btn-primary">Login</button>
    </form>
</div>
@endsection

Getting Started

  1. Install Laravel UI:
composer require laravel/ui
  1. Generate authentication scaffolding:
php artisan ui bootstrap --auth
  1. Install and compile frontend assets:
npm install && npm run dev
  1. Run migrations to create necessary database tables:
php artisan migrate
  1. Start your Laravel application:
php artisan serve

You now have a basic authentication system set up with login, registration, and password reset functionality.

Competitor Comparisons

22,155

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Pros of Livewire

  • Real-time, dynamic UI updates without writing JavaScript
  • Seamless integration with Laravel, allowing for full-stack development in PHP
  • Simplified state management and component-based architecture

Cons of Livewire

  • Steeper learning curve for developers new to reactive frameworks
  • Potential performance overhead for complex applications with many components
  • Limited flexibility compared to full JavaScript frameworks

Code Comparison

Livewire Component

class SearchUsers extends Component
{
    public $search = '';

    public function render()
    {
        return view('livewire.search-users', [
            'users' => User::where('name', 'like', "%{$this->search}%")->get(),
        ]);
    }
}

Laravel UI Blade View

<form action="{{ route('search.users') }}" method="GET">
    <input type="text" name="search" value="{{ request('search') }}">
    <button type="submit">Search</button>
</form>

@foreach ($users as $user)
    <div>{{ $user->name }}</div>
@endforeach

Livewire offers a more reactive approach, updating the UI in real-time as the user types, while Laravel UI requires a form submission and page reload. Livewire's component-based structure allows for better organization of logic and view, whereas Laravel UI separates these concerns more traditionally.

6,204

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.

Pros of Inertia

  • Enables building modern single-page apps without the complexity of a full SPA framework
  • Seamless integration with server-side routing and controllers
  • Allows using server-side languages and frameworks alongside frontend JavaScript

Cons of Inertia

  • Steeper learning curve compared to traditional server-rendered views
  • Requires additional setup and configuration
  • May not be suitable for projects that need full SEO optimization

Code Comparison

Laravel UI:

Route::get('/home', [HomeController::class, 'index'])->name('home');

class HomeController extends Controller
{
    public function index()
    {
        return view('home');
    }
}

Inertia:

Route::get('/home', [HomeController::class, 'index'])->name('home');

class HomeController extends Controller
{
    public function index()
    {
        return Inertia::render('Home', [
            'title' => 'Welcome Home'
        ]);
    }
}

Summary

Inertia offers a modern approach to building web applications, bridging the gap between traditional server-rendered apps and SPAs. It provides a seamless developer experience but may require more initial setup. Laravel UI, on the other hand, offers a simpler, more traditional approach to building web interfaces, which may be more suitable for smaller projects or developers new to modern JavaScript frameworks.

27,910

A rugged, minimal framework for composing JavaScript behavior in your markup.

Pros of Alpine

  • Lightweight and minimal, with a smaller footprint than Laravel UI
  • Can be used independently of any backend framework
  • Easier to integrate into existing projects without major refactoring

Cons of Alpine

  • Less opinionated, requiring more manual setup for complex applications
  • Fewer built-in UI components compared to Laravel UI
  • May require additional libraries for advanced features like routing

Code Comparison

Alpine:

<div x-data="{ open: false }">
    <button @click="open = !open">Toggle</button>
    <div x-show="open">Content</div>
</div>

Laravel UI:

@extends('layouts.app')

@section('content')
    <example-component></example-component>
@endsection

Alpine focuses on adding interactivity directly in HTML, while Laravel UI typically uses Vue components within Blade templates. Alpine's approach is more inline and declarative, whereas Laravel UI separates concerns more distinctly between HTML and JavaScript.

Alpine is better suited for adding simple interactivity to existing projects, while Laravel UI provides a more structured approach for building full-featured SPAs within the Laravel ecosystem. The choice between them depends on project requirements, team familiarity, and the desired level of integration with Laravel.

17,515

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.

Pros of Filament

  • More comprehensive admin panel solution with advanced features like CRUD operations, form builders, and data tables
  • Modern, responsive UI design out-of-the-box
  • Extensive customization options and plugin ecosystem

Cons of Filament

  • Steeper learning curve due to more complex architecture
  • Potentially overkill for simple projects or basic authentication needs
  • Requires more setup and configuration compared to Laravel UI

Code Comparison

Laravel UI:

php artisan ui bootstrap --auth
npm install && npm run dev

Filament:

composer require filament/filament
php artisan filament:install
php artisan make:filament-user

Key Differences

  • Laravel UI focuses on basic authentication scaffolding, while Filament provides a full-featured admin panel
  • Filament offers more built-in components and utilities for rapid development of admin interfaces
  • Laravel UI integrates with frontend frameworks like Bootstrap, while Filament has its own UI system
  • Filament requires more initial setup but offers greater flexibility and features for complex admin needs

Use Cases

  • Laravel UI: Quick authentication setup for simple projects or as a starting point for custom development
  • Filament: Building feature-rich admin panels, dashboards, and CRUD interfaces for complex applications

A set of renderless components to utilise in your Laravel Blade views.

Pros of Blade UI Kit

  • Offers a wider range of pre-built UI components
  • Provides more customization options for components
  • Includes JavaScript-powered components for enhanced interactivity

Cons of Blade UI Kit

  • Steeper learning curve due to more complex component structure
  • Requires additional setup and configuration compared to Laravel UI
  • May have a larger footprint in terms of file size and dependencies

Code Comparison

Laravel UI:

@extends('layouts.app')

@section('content')
<div class="container">
    <h1>Welcome</h1>
</div>
@endsection

Blade UI Kit:

<x-layouts.app>
    <x-container>
        <x-heading>Welcome</x-heading>
    </x-container>
</x-layouts.app>

Summary

Laravel UI provides a simpler, more straightforward approach to basic UI scaffolding, making it ideal for quick prototypes or smaller projects. It offers essential authentication views and basic Bootstrap styling out of the box.

Blade UI Kit, on the other hand, offers a more comprehensive set of UI components and greater flexibility in customization. It's better suited for larger, more complex projects that require a wider range of UI elements and more advanced interactivity.

The choice between the two depends on the project's requirements, complexity, and the developer's familiarity with the respective libraries. Laravel UI is easier to get started with, while Blade UI Kit offers more power and flexibility at the cost of a steeper learning curve.

Associate files with Eloquent models

Pros of Laravel Media Library

  • Comprehensive media management with advanced features like image conversions and responsive images
  • Supports multiple file storage drivers (local, S3, etc.) out of the box
  • Extensive documentation and active community support

Cons of Laravel Media Library

  • Steeper learning curve due to more complex functionality
  • May be overkill for simple file upload needs
  • Requires additional configuration and setup compared to UI package

Code Comparison

Laravel UI (Basic file upload):

$request->file('avatar')->store('avatars');

Laravel Media Library (Adding media to a model):

$user->addMedia($request->file('avatar'))
     ->toMediaCollection('avatars');

Key Differences

Laravel UI is a lightweight package focused on scaffolding basic authentication views and routes. It's ideal for quickly setting up user interfaces in Laravel applications.

Laravel Media Library, on the other hand, is a robust solution for managing media files associated with Eloquent models. It offers advanced features like file conversions, collections, and custom storage configurations.

Choose Laravel UI for simple authentication scaffolding, and Laravel Media Library for comprehensive media management in your Laravel projects.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Laravel UI

Total Downloads Latest Stable Version License

Introduction

While Laravel does not dictate which JavaScript or CSS pre-processors you use, it does provide a basic starting point using Bootstrap, React, and / or Vue that will be helpful for many applications. By default, Laravel uses NPM to install both of these frontend packages.

This legacy package is a very simple authentication scaffolding built on the Bootstrap CSS framework. While it continues to work with the latest version of Laravel, you should consider using Laravel Breeze for new projects. Or, for something more robust, consider Laravel Jetstream.

Official Documentation

Supported Versions

Only the latest major version of Laravel UI receives bug fixes. The table below lists compatible Laravel versions:

VersionLaravel Version
1.x5.8, 6.x
2.x7.x
3.x8.x, 9.x
4.x9.x, 10.x, 11.x

Installation

The Bootstrap and Vue scaffolding provided by Laravel is located in the laravel/ui Composer package, which may be installed using Composer:

composer require laravel/ui

Once the laravel/ui package has been installed, you may install the frontend scaffolding using the ui Artisan command:

// Generate basic scaffolding...
php artisan ui bootstrap
php artisan ui vue
php artisan ui react

// Generate login / registration scaffolding...
php artisan ui bootstrap --auth
php artisan ui vue --auth
php artisan ui react --auth

CSS

Laravel officially supports Vite, a modern frontend build tool that provides an extremely fast development environment and bundles your code for production. Vite supports a variety of CSS preprocessor languages, including SASS and Less, which are extensions of plain CSS that add variables, mixins, and other powerful features that make working with CSS much more enjoyable. In this document, we will briefly discuss CSS compilation in general; however, you should consult the full Vite documentation for more information on compiling SASS or Less.

JavaScript

Laravel does not require you to use a specific JavaScript framework or library to build your applications. In fact, you don't have to use JavaScript at all. However, Laravel does include some basic scaffolding to make it easier to get started writing modern JavaScript using the Vue library. Vue provides an expressive API for building robust JavaScript applications using components. As with CSS, we may use Vite to easily compile JavaScript components into a single, browser-ready JavaScript file.

Writing CSS

After installing the laravel/ui Composer package and generating the frontend scaffolding, Laravel's package.json file will include the bootstrap package to help you get started prototyping your application's frontend using Bootstrap. However, feel free to add or remove packages from the package.json file as needed for your own application. You are not required to use the Bootstrap framework to build your Laravel application - it is provided as a good starting point for those who choose to use it.

Before compiling your CSS, install your project's frontend dependencies using the Node package manager (NPM):

npm install

Once the dependencies have been installed using npm install, you can compile your SASS files to plain CSS using Vite. The npm run dev command will process the instructions in your vite.config.js file. Typically, your compiled CSS will be placed in the public/build/assets directory:

npm run dev

The vite.config.js file included with Laravel's frontend scaffolding will compile the resources/sass/app.scss SASS file. This app.scss file imports a file of SASS variables and loads Bootstrap, which provides a good starting point for most applications. Feel free to customize the app.scss file however you wish or even use an entirely different pre-processor by configuring Vite.

Writing JavaScript

All of the JavaScript dependencies required by your application can be found in the package.json file in the project's root directory. This file is similar to a composer.json file except it specifies JavaScript dependencies instead of PHP dependencies. You can install these dependencies using the Node package manager (NPM):

npm install

By default, the Laravel package.json file includes a few packages such as lodash and axios to help you get started building your JavaScript application. Feel free to add or remove from the package.json file as needed for your own application.

Once the packages are installed, you can use the npm run dev command to compile your assets. Vite is a module bundler for modern JavaScript applications. When you run the npm run dev command, Vite will execute the instructions in your vite.config.js file:

npm run dev

By default, the Laravel vite.config.js file compiles your SASS and the resources/js/app.js file. Within the app.js file you may register your Vue components or, if you prefer a different framework, configure your own JavaScript application. Your compiled JavaScript will typically be placed in the public/build/assets directory.

The app.js file will load the resources/js/bootstrap.js file which bootstraps and configures Vue, Axios, jQuery, and all other JavaScript dependencies. If you have additional JavaScript dependencies to configure, you may do so in this file.

Writing Vue Components

When using the laravel/ui package to scaffold your frontend, an ExampleComponent.vue Vue component will be placed in the resources/js/components directory. The ExampleComponent.vue file is an example of a single file Vue component which defines its JavaScript and HTML template in the same file. Single file components provide a very convenient approach to building JavaScript driven applications. The example component is registered in your app.js file:

import ExampleComponent from './components/ExampleComponent.vue';
Vue.component('example-component', ExampleComponent);

To use the component in your application, you may drop it into one of your HTML templates. For example, after running the php artisan ui vue --auth Artisan command to scaffold your application's authentication and registration screens, you could drop the component into the home.blade.php Blade template:

@extends('layouts.app')

@section('content')
    <example-component></example-component>
@endsection

Remember, you should run the npm run dev command each time you change a Vue component. Or, you may run the npm run watch command to monitor and automatically recompile your components each time they are modified.

If you are interested in learning more about writing Vue components, you should read the Vue documentation, which provides a thorough, easy-to-read overview of the entire Vue framework.

Using React

If you prefer to use React to build your JavaScript application, Laravel makes it a cinch to swap the Vue scaffolding with React scaffolding:

composer require laravel/ui

// Generate basic scaffolding...
php artisan ui react

// Generate login / registration scaffolding...
php artisan ui react --auth

Adding Presets

Presets are "macroable", which allows you to add additional methods to the UiCommand class at runtime. For example, the following code adds a nextjs method to the UiCommand class. Typically, you should declare preset macros in a service provider:

use Laravel\Ui\UiCommand;

UiCommand::macro('nextjs', function (UiCommand $command) {
    // Scaffold your frontend...
});

Then, you may call the new preset via the ui command:

php artisan ui nextjs

Contributing

Thank you for considering contributing to UI! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

Laravel UI is open-sourced software licensed under the MIT license.