What's wrong with my Composer workflow?
Answered
Hi!
Looks like I misunderstood some concepts of working with Composer in PhpStorm. Here's the case.
I work with legacy application and need to use Twig and PHPWord packages. When I install it ($ composer require <package/name> ) through CLI PhpStorm adds new directories in vendor/ to Settings - Directories - Excluded Folders. And I can not use auto-import and/or auto-complete for those newly installed packages until I manually remove (eg. vendor/phpoffice/phpword) from Excluded Folders. Is it normal behaviour or I need properly setup PhpStorm to not auto-exclude 'main' Composer packages folder?
Please sign in to leave a comment.
How does that "vendor/twig/twig" folder looks in the Project View? -- show a screenshot.
What I may suggest:
Yes please.
1) Close that project in IDE (in case if you have reopening last opened project option enabled)
2) Close IDE
3) Delete that .idea subfolder
4) Open IDE and using "Open" from Welcome screen point to the project root -- IDE will create new project from those files
OK, solved! Thanks again!
Hi there,
When package's folder that was installed by Composer ("vendor/phpoffice/phpword" for example) is marked as Excluded, then (at the same time) it should be added as "PHP Include Path" entry for the code completion to remain working.
Therefore -- please check if full path to the "vendor/phpoffice/phpword" folder (for example) is present in "Settings/Preferences | Languages & Frameworks | PHP".
Overall -- this all should be done automatically by the IDE (does it here for me ll the time). Maybe you have not initialised Composer integration yet ... or ignored/declined some popup that was offering to do that? Not sure.. but please check idea.log file (Help | Show Log in...) for possible details (in case if there are some errors there).
Thanks, Andriy, for prompt replay!
But in my case I have all the mentioned directories in PHP Include Path and I can not use auto-completion until removing them from Excluded Folders. I remember that few months ago when I first add Twig to the project I faced with the issue, read documentation, struggle a little with different PHP Include Path and Excluded Folder combinations and decided just remove vendor/twig/twig from Excluded Folder. Tomorrow I started playing with PHPWord package and faced with the issue for the second time. Seems like ... In fact I have no idea what's wrong with my PhpStorm. If it matters I'm on Ubuntu Xenial with the latest PhpStorm installed.
Whoa! It really works great on brand new project with the same set of third-party plugins installed. Looks like I should drop .idea/ folder for the project, shouldn't I?
Yeah, I dropped .idea/ folder and re-open project directory in PhpStorm. Now it works OK - it both excluded folders and add them to include path. Thank you, Andriy!