Laravel | Artisan Console Introduction

Laravel has its own Command Line interface called Artisan. Its like a Linux command line but the commands are helpful for building a Laravel application. With this command-line tool, we can make models, controllers, and can do data migrations and many more. First, we will have to change the directory in your command line console (i.e. cmd on windows or terminal on Linux/Mac) or any other CLI software, to the directory of your Laravel app.

All artisan commands: Then by writing ‘php artisan list’ in the console, we will be able to see all the artisan commands that can be used. We can also write ‘php artisan’ and press enter, to display all the available commands in the artisan console. With this command, we will be able to see a long list of commands that the php artisan supports.

  • Command:
    php artisan list

    or



    php artisan
  • Output:

To get help: If we want to know more about any command then we can write:

  • Command:
    php artisan help

    or

    php artisan help make:model
  • Output:

Version check: If we want to know the version of our Laravel app then we can write ‘-V‘ option.

  • Command:
    php artisan -V
  • Output:

Make commands: If these are not enough, then we can make our own command by using make:command. Know more of it by using the help command as described above in To get help section.

  • Command:
    php artisan make:controller

Console Environment: There is one console environment that the Artisan provides and that is tinker. The Tinker gives you an environment with the help of which the user can interact with the Laravel application and gives a simple way to access the data in the database.

  • Command:
    php artisan tinker
  • Output:

Reference: https://laravel.com/docs/6.x/artisan



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.