Tania from Russia
Tania from Russia

Reputation: 41

Need install Laravel-ide-helper for VS Code

I use VS Code, not use PHP Storm. Should I install 'laravel-ide-helper'?

Upvotes: 3

Views: 3580

Answers (2)

McAuley
McAuley

Reputation: 424

It does help with code completion (automatically importing classes, showing methods, etc..). It works with VSCode the same as it does for PHPStorm as far as I can tell. The 'ide-helper-models' also appears to work the same. I'm unsure what the 'ide-helper:meta' does, but the docs only mention support for PHPStorm.

Upvotes: 1

morzey
morzey

Reputation: 31

You can require this package with composer using the following command:

composer require --dev barryvdh/laravel-ide-helper

Then if you are using Laravel versions older than 5.5, add the service provider to the providers array in config/app.php:

Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class

In Laravel, instead of adding the service provider in the config/app.php file, you can add the following code to your app/Providers/AppServiceProvider.php file, within the register() method:

public function register(){
    if ($this->app->environment() !== 'production') {
      $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
    }
    // ...
}

This basically allow your application to load the Laravel IDE Helper on non-production environments.

Upvotes: 3

Related Questions