Can't setup relative path in PHP-Storm for Codeigniter 4 Follow
Hello,
i am not able to setup relative paths for my Codeigniter 4 app.
Codeigniter public folder is already the document root. So i have following folder structure:
Codeigniter4 (PHP-Storm Project Root)
-app
-public\noah\css (Ressource root and "public" is the Server Document Root)
-system (Sources)
If i want to get a relative path for a stylesheet i need just "/noah/css/style.css" but i always get "/public/noah/css/style.css".
So i assigned "Ressource Root" to the public directory but still i only get the full path including "/public/".
Also i noticed that there is no option "Select Path from Ressource Root" but there is an option "Copy Path from Content Root". So why is that?
How can i tell PHP-Storm to give me relative links for files inside the public directory without "/public" inside the given path?
Best regards,
Michael
Please sign in to leave a comment.
Why did you set
css
as a resource root? It makes sense to markpublic
instead.Also, what exactly do you do to get the wrong path, invoke completion?
https://recordit.co/8yGmvQoRt1
I never had css set as a ressource root. As i already mentioned - i have set "public" as a ressource root. But i can not get the path without the public entry.
See the difference when using "Copy Path"?
For the "Ressource Root" i get the path only with "public".
For the "Sources" i get the path without "public".
Ah, I see now. There's no way to copy a path relative to a resource root. Instead, you can mark public as a source root (along with resource root), this would give you the desired option.
Yes - but the problem there is that PHP-Storm resets the directory marking after restart.
So i changed it to:
After restarting PHP-Storm
When PHP-Storm is starting i can see the correctly marked "public" directory as a "source" but the suddenly the mark is gone while loading the project. I already have deleted the whole project an reloaded the files from the server but it seems like PHP-Storm can not handle 2 "source" directories at the same time.
Also PHP-Storm takes the "system" directory by itself and marks it as "sources".
PhpStorm configures the directories accordingly to the composer.json file. You can disable this behavior at Settings | Languages & Frameworks | PHP | Composer | Synchronize IDE Settings with composer.json.
Deactivating the sync did the trick! Thank you very much!
Best regards,
Michael