Laravel 12 - How to Install Laravel Breeze
Laravel 12 - How to Install Laravel Breeze
In this tutorial, you'll set up authentication in Laravel 12 with Breeze. Follow step-by-step instructions to install Laravel, configure authentication, and test login & registration using Blade and Alpine.js.
If you're a video person, feel free to skip the post and check out the video instead!
Quick Overview
This guide walks you through setting up a fresh Laravel project and integrating authentication using Laravel Breeze. You'll start by creating a new Laravel project, configuring the database, and installing Laravel Breeze. After generating authentication scaffolding with Blade and Alpine.js, you'll migrate the database and install dependencies. Finally, you'll launch the Laravel development server, test the registration and login functionality, and confirm successful authentication. By the end, you'll have a fully functional Laravel application with a minimal authentication setup, ready for further customization and expansion with additional features as needed.
Step # 1 : Create fresh Laravel project.
Note : If Laravel isn’t installed globally, you must install it first. Assuming Composer is already installed, run the following command.
composer global require laravel/installer
Next, create a new Laravel project using the global Laravel installer.
laravel new Breeze
During the setup, you’ll be prompted with the following options.
- Which starter kit would you like to install? → Select None
- Which database will your application use? → Select MySQL
- Default database updated. Would you like to run the default database migrations? → Type No
- Would you like to run npm install and npm run build? → Type Yes
After completing the prompts, Laravel will create a new project named Breeze with the default directory structure. No starter kit will be installed, and the database will be set to MySQL without running migrations. Additionally, npm dependencies will be installed, and assets will be built automatically, providing a minimal yet ready-to-use setup for further customization.
Step # 2 : Access the project.
Open a terminal (Git Bash, Command Prompt, or Terminal) and move to your Laravel project's root directory using.
cd c:xampp/htdocs/Breeze
From there, you can execute commands to start the server, install dependencies, or adjust configurations.
Step # 3 : Install Laravel Breeze Package.
To install Laravel Breeze in your project, run the following Composer command.
composer require laravel/breeze --dev
This will install Laravel Breeze, a lightweight authentication scaffolding package that provides a simple and customizable starting point for authentication. However, the scaffolding is not applied automatically and must be set up in the next step to enable authentication views and routes.
Step # 4 : Set Up Authentication Scaffolding.
Generate the authentication scaffolding by running the following command in your terminal.
php artisan breeze:install
During the setup, you will be prompted to select various options for authentication scaffolding.
Which Breeze stack would you like to install?
- Blade with Alpine
- Livewire (Volt Class API) with Alpine
- Livewire (Volt Functional API) with Alpine
- React with Inertia
- Vue with Inertia
- API only
→ Select blade
Would you like dark mode support? (yes/no) [no]
→ Type no
Finally, choose a testing framework.
Pest ..................................................................... 0
PHPUnit .................................................................. 1
→ Select Pest
Once completed, Laravel Breeze will configure authentication scaffolding with Blade and Alpine.js, providing ready-to-use authentication views, routes, and controllers. It also integrates Pest for testing, allowing you to write unit and feature tests efficiently. At this point, your Laravel application has a basic authentication system, including login, registration, password reset, and email verification features, ready for customization and further enhancements.
Step # 5 : Run Database Migrations.
Run the following command to migrate the database.
php artisan migrate
If the database doesn’t exist, you may see the following warning.
WARN The database 'Breeze' does not exist on the 'mysql' connection.
Would you like to create it? → Type Yes
Type yes to create the database and proceed with the migrations. This will set up the necessary tables for authentication and other default Laravel functionalities, ensuring your application is ready to handle user registrations, logins, and other database-driven operations.
Step # 6 : Let's see it in Action.
Now that everything is set up, let’s start the Laravel development server. Run the following command in your terminal.
php artisan serve
Once the server is running, open 127.0.0.1:8000 in your browser to view the home page of your Laravel project. If everything is configured correctly, you should see the default Laravel welcome page.
Now, it's time to verify the registration process. You can do this by either navigating to the register URL manually or clicking the Register button on the home page. This will take you to the registration form, where you can enter your details, such as name, email, and password, before submitting the form.
After submitting the registration form, the system will process your information, create a new user account, and redirect you to the dashboard. This confirms that your registration was successful and that authentication is working as expected. The dashboard serves as the authenticated area of your application, where users can access protected content.
Next, let's test the login functionality. You can either manually visit the login URL or click on the Login button on the home page. This will open the login form, where you can enter the credentials you used during registration. Enter the same credentials you used during registration, and once you log in, you will be redirected to the dashboard again, confirming that the authentication process is working correctly. Laravel will authenticate your credentials and ensure that the login process functions as expected. If the login is successful, you’ll see the dashboard just like before, verifying that your authentication system is fully operational and ready for further enhancements.
At this point, both the registration and login processes have been successfully tested, ensuring that your Laravel authentication system is working seamlessly. You now have a functional authentication setup that can be customized and extended based on your project requirements.
Conclusion
By following this guide, you have successfully set up a fresh Laravel project with authentication using Laravel Breeze. You configured the database, installed dependencies, and generated authentication scaffolding with Blade and Alpine.js. Additionally, you migrated the database and tested both the registration and login processes to ensure authentication works seamlessly. With this foundation in place, you can now extend your project by adding new features, customizing the UI, or integrating additional functionalities to enhance the user experience. Laravel’s flexibility and simplicity make it an excellent choice for building scalable applications, whether for small projects or large enterprise solutions.
For more details, refer to the official Laravel Breeze documentation.
Share this with friends!
To engage in commentary, kindly proceed by logging in or registering
Subscribe to Our Newsletter
Stay ahead of the curve! Join our newsletter to see what everyone’s talking about.
0 Comments