How to Run Laravel Artisan Commands in Visual Studio Code

Laravel ships with a command-line interface called Artisan Console. While building an application in Laravel, you can use this command-line interface for various reasons. It allows you to create a controller, model, migrations, event, clear caches, and much more. If you closely look at the root files of your Laravel project, you will notice the artisan file which is responsible for all Artisan commands.

Though it is a command-line interface, you can run Artisan commands within your text editor like Sublime Text, Visual Studio Code. These 2 are the most popular editors among developers. I already wrote an article running Artisan commands in Sublime Text. In this quick tutorial, I show you how to run Artisan commands in Visual Studio Code.

Install Laravel Artisan Extension in Visual Studio Code

VSCode comes with tons of extensions that support your development workflow. Using extensions, one can achieve their stuff within the editor itself without going to another tool or somewhere else.

For example, if you want to test REST APIs, you can use Rest Client Extension in VSCode. This extension allows you to test REST APIs within the editor. You don’t need to use any other software like Postman, etc.

Laravel Artisan is an extension which helps you to run Laravel Artisan commands within Visual Studio Code.

For installing this extension open the VSCode, click on the Extension icon, type Laravel Artisan in the search field, and finally click on ‘Install’. Refer to the screenshot below.

install-laravel-artisan-extension

Run Laravel Artisan Extension in Visual Studio Code

Once you installed the Laravel Artisan extension to VSCode, you don’t need to use the command-line interface. All commands will be available for you within the editor.

To run the Artisan commands, type ctrl+shift+p on Windows machine and cmd+shift+p on macOS. It will prompt you a search field where you should type artisan which will then prompt you all available Artisan commands. Select any of the commands you wish to run and it will give you the expected output.

artisan-commands-vscode

It’s all about running Laravel Artisan commands in Visual Studio Code. Please share your thoughts and suggestions in the comment section below.

Related Articles

If you liked this article, then please subscribe to our YouTube Channel for video tutorials.

Leave a Reply

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