Chapter 4 - Authentication with Breeze

Hello Artisans, In this chapter we'll discuss about Laravel Breeze for authentication. Laravel Breeze is alternative for laravel/ui which one used for authentication till the laravel 7.0. Besides laravel/ui Breeze uses the Tailwind CSS. So if you already complete the third chapter/section the you're good to go, if not my recommendation would be please complete the third one.

Note: Tested on Laravel 10.0

Table of Contents

  1. Create New Project
  2. Install & Configure Laravel Breeze
  3. Configure Database and Migrate
  4. Output

Create New Project

Create a new Laravel application via command line. We can use either composer or laravel installer.

For Composer

composer create-project laravel/laravel artisanary

Or with laravel installer

composer global require laravel/installer //first need to install laravel installer
 
laravel new artisanary

Install & Configure Laravel Breeze

To install Laravel Breeze, you just have to fire the below command in your terminal

composer require laravel/breeze --dev

After the installation, we need to publish the authentication views, routes, controllers, and other resources which are needed for our authentication. So, fire the below command in your terminal.

php artisan breeze:install

After installing the Breeze we need to compile the static assets so that we can minify our css and js files. Minified assets can give us a faster load time and a reduced number of HTTP requests. To do so fire the below command.

npm install
npm run watch

Configure Database and Migrate

Now we need to configure the database in our .env file like below

.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=breeze
DB_USERNAME=root
DB_PASSWORD=

After setup, we need to run our migrations. So fire the below command in your terminal

php artisan migrate

Output

If you run your project then you can see the following outputs by visiting http://localhost:8000, make sure you serve your application via serve command by firing

php artisan serve

or as we use laragon, we don't need to fire the serve command. We can check our application by visiting  artisanary.test.

 

You can download the project from GitHub also. And as we use this git through our whole series, please try to keep up to date with this repo. That's it for today. See you in my next chapter. Happy coding ๐Ÿ™‚ .