2022-01-28 01:07:00

Getting Started with Laravel Breeze

Hamid Afghan

Laravel 8 offered several ways to begin a project. Breeze provided a straightforward authentication starter kit for developers who wanted a smaller starting point than Jetstream.

This article introduces Breeze and walks through installing it in a Laravel 8 application.

What is Laravel Breeze?

Laravel Breeze provides authentication scaffolding for login, registration, password resets, email verification and password confirmation. Its installation command adds the relevant files to your project. The templates in this tutorial use Tailwind CSS.

What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework. You compose styles by adding utility classes to your markup, which lets you customize the interface in the templates. See the Tailwind documentation at https://tailwindcss.com/.

You can also adapt the Blade templates supplied by Breeze to use Bootstrap or your own CSS.

Why Laravel Breeze?

According to the documentation: Breeze provides a wonderful starting point for beginning a fresh Laravel application and is also great choice for projects that plan to take their Blade templates to the next level with Laravel Livewire and many more.

Laravel Breeze Installation

First, create your Laravel project. The installation options for Laravel 8 are documented at https://laravel.com/docs/8.x/installation. I use the Laravel Installer in this example.

Open a terminal and move to the directory where you want to create the project:

composer global require laravel/installer
laravel new example-app
cd example-app

Next, open your .env file and set the connection details for your local development database:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=YourPassword or Null

From the project directory, example-app, install Breeze and run the setup commands:

composer require laravel/breeze --dev
php artisan breeze:install
npm install
npm run dev
php artisan migrate

Start the local development server:

php artisan serve

Breeze has now added the authentication scaffolding to the project.

Open the views folder to inspect the generated pages. The authentication routes are in routes/auth.php.

You can now review the generated templates and adapt them to your application.