Laravel Artisan commands

Laravel’s command-line tool is called Artisan, and it provides a variety of commands for tasks such as database migrations, testing, and more. Here are some commonly used Artisan commands in Laravel:

  1. General Commands:
  • php artisan list: List all available Artisan commands.
  • php artisan help command_name: Display help for a specific command.
  1. Development and Debugging:
  • php artisan serve: Start the development server.
  • php artisan tinker: Interact with your application from the command line.
  • php artisan make:controller ControllerName: Create a new controller.
  • php artisan make:model ModelName: Create a new model.
  • php artisan make:migration migration_name: Create a new database migration.
  1. Database:
  • php artisan migrate: Run any outstanding migrations.
  • php artisan migrate:status: Show the status of each migration.
  • php artisan db:seed: Seed the database with records.
  1. Testing:
  • php artisan test: Run your application tests.
  • php artisan make:test TestName: Create a new test class.
  1. Artisan Make Commands:
  • php artisan make:auth: Scaffold basic login and registration views and routes.
  • php artisan make:middleware MiddlewareName: Create a new middleware.
  • php artisan make:command CommandName: Create a new Artisan command.
  1. Route and View:
  • php artisan route:list: List all registered routes.
  • php artisan make:route: Generate a route file for faster route registration.
  • php artisan make:view ViewName: Create a new view file.
  1. Optimization:
  • php artisan optimize: Optimize the framework for better performance.
  • php artisan config:cache: Create a cache file for faster configuration loading.

These are just a few examples, and Laravel’s Artisan provides many more commands for various tasks. You can explore the full list and details in the official Laravel documentation or by running php artisan list. Additionally, you can get more information about a specific command by using php artisan help command_name.

Leave a comment

Your email address will not be published. Required fields are marked *