How to Install Laravel for Visual Studio Code?

Sinelogix > Laravel > How to Install Laravel for Visual Studio Code?
Install Laravel for Visual Studio Code

Visual Studio Code (VS Code), an open-source code editor developed by Microsoft, has gained immense popularity among developers for its versatility and a vast ecosystem of extensions that enhance its functionality.

If you’re a Laravel developer looking to harness the power of VS Code for your web development projects, you’re in the right place.

In this detailed guide, we’ll walk you through the step-by-step process of installing Laravel for Visual Studio Code, ensuring that you have all the essential tools and configurations to kickstart your Laravel projects efficiently.


Before we dive into the installation process, let’s ensure you have the following prerequisites:

  1. Visual Studio Code: You should have VS Code installed on your system. If you haven’t already, you can download it from the official website and follow the installation instructions.
  2. PHP Installed: Laravel is a PHP framework, so ensure that you have PHP installed on your system. You can install PHP separately or use a package like XAMPP or WAMP, which includes PHP, Apache, and MySQL.
  3. Composer: Composer is a dependency manager for PHP and an indispensable tool for Laravel development. Make sure you have Composer installed on your system. You can download it from
  4. Laravel Installer: To create new Laravel projects, you need to have the Laravel installer. You can install it globally using Composer with the command composer global require laravel/installer. Make sure to add Composer’s global bin directory to your system’s PATH.
  5. Web Server: While VS Code offers a lightweight built-in server, you might prefer to use a local development server like Apache or Nginx for more complex projects. Ensure your web server is set up and running.
  6. Database Server: Laravel typically uses a database to store application data. You can use MySQL, PostgreSQL, SQLite, or other supported databases. Make sure your database server is installed and running.
  7. Git: Git is essential for version control. Ensure you have Git installed and correctly configured.

Step 1: Create a New Laravel Project

The first step is to create a new Laravel project. Laravel provides a convenient command-line tool for this purpose:

  1. Open Visual Studio Code.
  2. Open the integrated terminal by going to View > Terminal or pressing Ctrl + Backtick (`).

In the integrated terminal, you can run Laravel Artisan commands. To create a new Laravel project, run the following command:

composer create-project --prefer-dist laravel/laravel my-laravel-app

Replace ‘my-laravel-app’ with the desired name for your Laravel project.

The above command will use Composer to download and install Laravel and its dependencies, setting up a new Laravel project for you in the specified directory.

Step 2: Open Your Laravel Project in Visual Studio Code

With your Laravel project created, it’s time to open it in Visual Studio Code:

  1. Open Visual Studio Code.
  2. Go to File > Open Folder and select the folder where you created your Laravel project.

Visual Studio Code will load your Laravel project, and you’ll be ready to start coding.

Step 3: Installing Laravel Extensions

Visual Studio Code offers a wide range of extensions that can enhance your Laravel development experience. Let’s explore some of the most popular ones:

1. Laravel Artisan

The “Laravel Artisan” extension provides support for running Artisan commands within VS Code. To install it:

  • Go to the Extensions sidebar in VS Code (icon on the left sidebar).
  • Search for “Laravel Artisan” and click “Install.”

Once installed, you can open the integrated terminal and run Artisan commands right from VS Code, making development tasks more accessible.

2. PHP Intelephense

“PHP Intelephense” is a feature-rich PHP extension that offers code completions, code navigation, and more. It’s especially handy when working with Laravel due to its extensive support for PHP. To install it:

  • Go to the Extensions sidebar in VS Code.
  • Search for “PHP Intelephense” and click “Install.”

This extension significantly improves your PHP coding experience and complements Laravel development.

3. Laravel Blade Snippets

For Blade templating in Laravel, the “Laravel Blade Snippets” extension can save you time and keystrokes by providing snippets for common Blade directives and syntax. To install it:

  • Go to the Extensions sidebar in VS Code.
  • Search for “Laravel Blade Snippets” and click “Install.”

This extension simplifies working with Blade templates, a core part of Laravel development.

Step 4: Configure Visual Studio Code for Laravel

VS Code allows you to configure workspace settings to optimize your Laravel development environment:

  1. Create a .vscode directory in your Laravel project root if it doesn’t already exist.
  2. Inside the .vscode directory, create a settings.json file to store your workspace-specific settings.
  3. Customize your settings based on your preferences and project requirements. Here are some common settings you might want to include:
"php.suggest.basic": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"php.validate.executablePath": "path/to/your/php-executable",
"php.validate.enable": true

The above settings disable basic PHP suggestions, enable automatic formatting and code actions on save, and specify the path to your PHP executable.

Step 5: Running Your Laravel Application

VS Code comes with a built-in extension called “Live Server” that allows you to run your Laravel application using a local development server:

  1. Open Visual Studio Code.
  2. In the file explorer, navigate to the public directory of your Laravel project.
  3. Right-click on the index.php file and select “Open with Live Server.”

VS Code will open a new browser window with your Laravel application running. You can access it locally at http://localhost:5500 a similar URL.

Related Articles:


Installing Laravel for Visual Studio Code is a straightforward process that can significantly enhance your Laravel development experience. VS Code, with its versatile set of extensions and customization options, offers a powerful environment for coding Laravel applications efficiently.

By following the steps outlined in this guide, you’ll have a fully configured Laravel development environment in Visual Studio Code, ready to create, develop, and deploy your Laravel projects with ease. Happy coding

Related Posts