I'm using Laravel 5.0 and everything works fine.
However, I keep getting these warning messages. I have looked at the JetBrains docs, but I remain a bit foggy what to do about it.
Essentially, I am concerned that if I allow PhpStorm to automatically run "Detect PSR0 Namespace Roots" then it could break my code / project.
Not sure what is going on, what should I do?
PSR-0, also known as the Autoloading Standard, prescribes that classes and namespaces in PHP should match the directory and file structure, and vice-versa. PSR-4 allows specifying a namespace prefix for a given directory explicitly.
PSR-0 looks at the namespace of a class and discerns its location on the hard drive from that bit of information. For example, the class \Zend\Mail\Message would lead to /path/to/project/lib/vendor/Zend/Mail/Message.
If you use composer
the more recent answer to synchronize with composer
is a better option.
PSR-4 namespace roots can specify a prefix which can be configured.
Here is the process:
src
.See PHPStorm configuring PHP namespaces
Easier than the last answers:
Go to the Settings windows: Languages & Frameworks -> PHP -> Composer and then, enable Sync IDE settings with composer.json in order to load the PSR-0 & PSR-4 set up.
PS: PhpStorm 2020.3.2 (Build #PS-203.7148.74, built on January 27, 2021)
I hope it's useful to everyone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With