How to remove Auth in Laravel (PHP artisan)
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Effortlessly Removing or Reinitializing Auth in Laravel (PHP artisan)
Body:
The Laravel framework has made life easier for developers by providing a robust authentications system using the php artisan make:auth command. However, there are instances where you might need to remove or reinitialize this functionality. In this comprehensive blog post, we'll explore the various options available and provide detailed steps on how to achieve your desired outcome.
Removing Auth in Laravel (PHP artisan)
If you need to completely remove the authentication system from your project, follow these steps: 1. Delete all files created by thephp artisan make:auth command. You can find them under app/Http/Controllers/{AuthController}, resources/views/auth, app/Console/Kernel.php, database/migrations/{TableUp/Down} or any other related folders and files.
2. Update your composer.json file to remove the required packages. Check for lines containing 'laravel/ui', 'spatie/laravel-permission' and 'intervention/image'. Remove these lines along with their respective dependencies if needed. Run composer update to update your project.
3. In app/Http/Kernel.php, remove the middleware for Auth:Route::middleware('auth')->group(function () {}); and any other related middleware. Save the file.
4. Delete or comment out the Auth::routes(); statement in routes/web.php to prevent the creation of auth-related routes.
5. If you're using a specific database like MySQL, remove the created user and the corresponding table related to authentication. Use phpMyAdmin or a similar tool to delete these tables.
6. To ensure that the next time you run php artisan make:auth, it creates everything afresh, update your .env file by adding the line APP_DEBUG=true. This will cause Laravel to clear its cache and recompile all existing files.
Remember that after deleting or commenting out the code, you may need to adjust your application logic to handle authentication properly.
Reinitializing Auth in Laravel (PHP artisan)
If you want to start fresh with a new auth system or just reinitialize it for some reason, follow these steps: 1. Delete all files related to the existing auth system as described above. 2. Runphp artisan make:auth again in your Laravel project's root directory. This command will generate a new authentication setup, including controllers, views, database migrations, middleware, and routes.
3. Update the application logic according to the newly generated files and folders, ensuring they align with your app's requirements.
4. Run php artisan migrate or php artisan migrate:fresh to create the necessary database tables using your new migration files.
5. Adjust any other configuration settings as required by the new auth system, such as password policies and email verification.