php artisan make:auth command-is-not-defined (Laravel 8)

I was amazed when I got the “command not defined” error message in my new Laravel project installation.

I quickly cross checked my writings to ensure that I was typing the command which I have been using from day I first wrote a Laravel application…and it was correct. Yet I keep getting the same error message.

I even checked my installations, to ensure all the required packages were installed. It was then, it occurred to my mind that Laravel 8 was just lunched and there could have been some changes made.

With the advent of Laravel 8, the Laravel development team thought it wise to extract Laravel view(UI) generation from the core Laravel application. This was necessary as the need to further develop Laravel UI(Views) to support most of the popular frontend frameworks avaliable.

This decision made our beloved “php artisan make:auth” command redundant and undefined from Laravel 8 and above.

In Laravel 8, to generate a view(UI) the following commands or steps are to be taken:

Step 1 — Create your Laravel Project

laravel new project 
cd project 
composer require laravel/ui

Laravel UI Composer package is a new first-party package that extracts the UI portion of a Laravel project ( frontend scaffolding typically provided with previous releases of Laravel ) into a separate laravel/ui package. The separate package enables the Laravel team to update, develop and version UI scaffolding package separately from the primary framework and the main Laravel codebase.

Step 2 — Then do this:

php artisan ui:auth

The above command will generate the auth routes, a HomeController, auth views, and a app.blade.php layout file.

php artisan ui bootstrap --auth

The above command will generate the auth routes, a HomeController, auth views, and a app.blade.php layout file and a bootstrap startup files.

php artisan ui vue --auth

The above command will also generate the auth routes and a VueJs starter template.

php artisan ui react --auth

The above command will also generate the auth routes and a React starter template.

On Laravel 5.8 and below, our beloved “php artisan make:auth” can still be used in the view scaffolding as shown below.

php artisan make:auth 

More Options in Laravel 8

You can also generate the views only, without the auth and controllers by using the commands:

php artisan ui:auth --views

The console command will prompt you to confirm overwriting auth files if you’ve already run the command before. For Vue Js views without auth files

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

and for React:

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

Don’t forget to run the “npm install” command after scaffolding VueJs or React views.

npm install
npm run dev

I trust this small story will be enough to keep you abay with some of the updates in the Laravel 8. You can read more the Laravel 8 docs here

Don’t forget to comment, share  for other exciting updates. Stay hungry.

Published by anitanad

I'm a Software developer, designer, writer, and a Chef. I build open source projects and write tutorials

Leave a Reply