Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bentz's avatar
Level 4

Path Resolution in PHPStorm

Hey there everyone!

I'm setting up a new Laravel project and I am using PHPStorm. I couldn't help but notice that PHPStorm can't resolve paths in blade templates that are relative to the public/ directory.

Does anyone know of a quick way to address this, without having to use full urls or the blade URL functions?

For example:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="img/favicon.png">
    <title>Demo Page</title>
    <link rel="stylesheet" href="css/app.css" type="text/css"/>
  </head>

In the above case, "img/favicon.png" and "css/app.css" are underlined as invalid paths due to PHPStorm not recognizing the paths are relative to the public/ directory.

No, it's not a super big deal. Yes, I know I can disable path resolution warnings in Settings > Inspections... but I'd rather just find a way to get PHPStorm to realize where the files are located.

Thanks for your time!

0 likes
3 replies
bentz's avatar
bentz
OP
Best Answer
Level 4

Oh wow. Just after posting this, I found the answer.

It's in Settings > Directories.

In case anyone else ever stumbles upon this... Go to Settings > Directories, locate the public directory within the Laravel project, right click on it and select "Resource Root". Hit apply. It took a few minutes for everything to catch up. Restarting PHPStorm may speed it up.

Now, all the paths are resolving correctly. The files even pop up in suggestions.

1 like
dexo's avatar

@bentz Thank you so much for that! Thats awesome.

1 like
Merklin's avatar

While relative path might be 'the easy way', I always preffer to use {{ asset('') }}. Thinks it's safer this way and nothing can go wrong.

Please or to participate in this conversation.