Published on: July 15, 2025 | Author: Rana Saha
Laravel Artisan is a powerful command-line tool that helps developers manage their applications with ease. From generating files to running tests, Artisan commands save time and reduce repetitive work. In this blog, we’ll explore the top 50 Artisan commands every Laravel developer should know.
๐ Project & Environment
php artisan serve– Run Laravel development server.php artisan config:cache– Cache the configuration files.php artisan config:clear– Clear the config cache.php artisan cache:clear– Clear the application cache.php artisan route:cache– Cache the route definitions.php artisan route:clear– Remove the route cache.php artisan view:clear– Clear compiled view files.php artisan optimize– Optimize the framework for better performance.
๐งฑ Migrations & Database
php artisan migrate– Run the database migrations.php artisan migrate:rollback– Rollback the last migration.php artisan migrate:reset– Rollback all migrations.php artisan migrate:refresh– Reset and re-run all migrations.php artisan migrate:fresh– Drop all tables and re-run all migrations.php artisan db:seed– Seed the database with records.php artisan db:wipe– Drop all tables, views, and types.php artisan make:migration create_posts_table– Create a new migration file.
๐งฌ Models & Factories
php artisan make:model Post– Create a new model.php artisan make:model Post -m– Create model with migration.php artisan make:model Post -mf– Model with migration and factory.php artisan make:factory PostFactory– Create a model factory.
๐ง Controllers & Resources
php artisan make:controller PostController– Create a new controller.php artisan make:controller PostController --resource– Resourceful controller.php artisan make:controller Api/PostController --api– API controller.
๐งฉ Middleware, Requests & Events
php artisan make:middleware CheckRole– Create a middleware.php artisan make:request StorePostRequest– Create a form request class.php artisan make:event PostCreated– Create an event.php artisan make:listener SendNotification --event=PostCreated– Create event listener.
๐ก Commands, Jobs & Notifications
php artisan make:command SendEmails– Create a custom Artisan command.php artisan make:job ProcessPodcast– Create a job.php artisan make:notification InvoicePaid– Create a notification.php artisan queue:work– Process jobs from the queue.php artisan queue:restart– Restart queue workers.
๐งช Testing
php artisan test– Run all PHPUnit tests.php artisan make:test PostTest– Create a test class.php artisan test --filter=PostTest– Run specific test class.
๐️ Miscellaneous
php artisan tinker– Interact with your app from the command line.php artisan schedule:run– Run scheduled tasks.php artisan event:cache– Cache events and listeners.php artisan storage:link– Create a symbolic link to storage.php artisan down– Put the app into maintenance mode.php artisan up– Bring the app out of maintenance mode.
๐ ️ Bonus: List All Artisan Commands
php artisan list– Display all available Artisan commands.php artisan help migrate– Display help for a specific command.
๐ Conclusion
Mastering Laravel Artisan commands is key to faster development and better workflow. These commands not only reduce manual effort but also help you follow Laravel’s best practices. Bookmark this post or print it as a reference for your daily development.
Did I miss any important command you use daily? Drop a comment and share your thoughts!
๐ Also Read: 15 Common Git Commands Every Developer Should Know
Comments
Post a Comment