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

mstnorris's avatar

Help using PhpStorm, import class only works with leading slash

For some reason PhpStorm has stopped letting me import classes using the keyboard shortcut alt + enter (Mac OS X - PhpStorm 8).

If I type \ClassNameHere then it works, but before I could just type anything and it will be smart and try and get it right.

0 likes
12 replies
michaeldyrynda's avatar

I think - though I'm not sure - that something changed in a recent update.

If you use a class from the global scope i.e. \Request, PhpStorm will import the Request alias. Previously importing Request would import the facade itself (at least in my experience).

At least now you only have to enter the backslashed class name once, then import and forget. May or may not have something to do with the fact that L5 is all namespaced, but I couldn't say for sure.

mstnorris's avatar

@deringer it was working absolutely fine until an update, that functionality was helpful. Do you or anyone know a way to get it back?

bobbybouwmann's avatar

It's still working fine for me!

Are you sure you have the action "Show Intention Actions" mapped to "alt" + "return". You can check this in your preferences and search for "keymap". If you click the search/loop icon you can press a key to find the binded actions.

mstnorris's avatar

@blackbird Yes I do. May I ask what your "Auto Import" settings look like. I've since changed but, but to no avail.

mstnorris's avatar

Yes I did, and that is what mine looks like. So I am not sure what the issue is.

This is the version I am using Imgur

mstnorris's avatar

Bugger that! I have reset my keycap and last night I reset everything. Not sure what else to do.

I assume you mean that import still works without the need for a leading "" ?

bashy's avatar

v9 is nice, not tried it yet? It may solve some issues.

mstnorris's avatar

@bashy I have downloaded that since the issue occurred but that has the same problem.

glennkarlsen's avatar

Did you find any solution for this? I'm having the same issue with PhpStorm version 2016.2.

Marvin's avatar

I have met this problem too, with Laravel 5.3 and PhpStorm version 2016.2.1

Please or to participate in this conversation.