PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, April 19, 2022

[FIXED] How to make PhpStorm recognize Laravel aliases?

 April 19, 2022     laravel, phpstorm     No comments   

Issue

The Laravel package comes with an aliases array in config/app.php

Essentially, it allows to import shorter namespaces at the start of your document.

For example, I can import the Illuminate\Support\Facades\DB::class class just by DB:

<?php 

namespace App\Services\Whatever;

use DB;

However, this generates a warning in my PhpStorm editor

Warning:(4,5) Undefined class 'DB'

Is there a way to make PhpStorm aware of the aliases? Or am I forced to not use the Laravel aliases in order to resolve those IDE warnings?


Solution

Try to copy this file to the root folder of your laravel project:

https://gist.github.com/barryvdh/5227822



Answered By - galloleonardo
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing