Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need install Laravel-ide-helper for VS Code

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

like image 711
Tania from Russia Avatar asked Jan 31 '26 22:01

Tania from Russia


2 Answers

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.

like image 80
morzey Avatar answered Feb 02 '26 16:02

morzey


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.

like image 41
McAuley Avatar answered Feb 02 '26 15:02

McAuley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!