Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Intelliphense not working properly with Laravel Projects

In VSCode the PHP intelephense extension version 1.3.7 marks the laravel Facades as classes not found. Before if you import a Facade like this:

use Log;

and then use it in the file like this:

Log::info('some message');

which is correct there were no issues. Now every usage is marked as a syntax error and you have to import the fully qualified name like the following for the error to go away.

use \Illuminate\Support\Facades\Log;

Also it didn't used to complain about the Eloquent class's methods like find or where etc but now it underlines them as methods not defined.

Is there a way for the extension to ignore these?

like image 780
Mubashar Abbas Avatar asked Jan 06 '20 16:01

Mubashar Abbas


People also ask

Can I use VSCode for laravel?

Visual Studio Code is an amazing code editor, one of my favorites next to Atom and Sublime Text. Laravel is my favorite when it comes to enterprise PHP development. In this article, let me show you how I have configured Visual Studio Code(vscode from now on) for Laravel development.


Video Answer


1 Answers

You can try barryvdh/laravel-ide-helper.

it makes VScode to refer Facade files.

example)

    "require-dev": {
        ...
        "barryvdh/laravel-ide-helper": "^2.7",
        ...
    },
like image 62
byzz Avatar answered Nov 15 '22 14:11

byzz