Open In App

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.



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



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

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.

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.

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

Article Tags :