PhpStorm - Create normal HTML, JS, CSS project - html

Is it possible to create a simple Project which only uses HTML, JavaScript and CSS, or do I have to use netbeans?
I tried to start a new project, but I have only these options:
and I am not sure what "HTML5 Boilerplate" is.

Just use the top most "PHP Empty Project" option.
If you do not have local or remote PHP -- just choose <no interpreter> option for "CLI Interpreter" field.
In the end you will get empty project.
Alternative solution:
Create empty project folder using your file manager/terminal.
Using PhpStorm use Open from Welcome screen (or File | Open Directory if you have some project already opened") and point to the project root folder -- IDE will create new project (or reuse existing one (if it finds .idea subfolder)) from those files.
I am not sure what "HTML5 Boilerplate
You may click on blue link on the top right corner of that screen and it will take you to the GitHub page for that project.
From there: https://github.com/h5bp/html5-boilerplate
HTML5 Boilerplate is a professional front-end template for building fast, robust, and adaptable web apps or sites.
This project is the product of many years of iterative development and combined community knowledge. It does not impose a specific development philosophy or framework, so you're free to architect your code in the way that you want.

Related

Create Vanila HTML / JS project inside PhpStorm where PHP has already been configured

I use Storm daily for PHP/Laravel, and hence have PHP configured. When I want to create a vanilla HTML / JS side project, Storm takes it upon itself to add the PHP libraries without asking. I don't want any PHP Libraries. When initially creating the project, I used "empty project".
Here is a screen shot to illustrate.
So, how to create an empty project without PHP libraries?
You are using PhpStorm, an IDE that supports PHP. That entry that you see there is a list of stubs for PHP (the stuff that IDE knows about core PHP and other common extensions: classes/functions/constants etc).
AFAIK it always will be there (as it's a PHP oriented IDE) and you cannot remove it. But you try this:
Settings (Preferences on macOS)
Languages & Frameworks | PHP
PHP Runtime tab
Uncheck ALL entries there.
If the above will not get rid of the whole node then you will have to ignore that entry. And I do not see any problems in having it here: it will not affect your JS/HTML in any way.
P.S. Whatever will be in a default/new project can be configured at File | New Projects Settings | Settings for New Projects...

PhpStorm: multiple projects with common core

Due to security reasons, I have to split one project to divisions (client, admin, ...), and deploy them to different web servers. These divisions have one common script base, but each division has its own functions. As an IDE I use PhpStorm.
The question: what is the best way to organize project's structure and settings, so the common core part will be visible for IDE indexing in all project's divisions, but at the same time, being maintained from a single project (perhaps, standalone)?
In Java you can do lib jar files for further linking in various projects.
But how it can be done in PHP?
There are multiple ways of how to reference extra PHP code in a project.
If you plan to actively edit such extra code in the same project (and want to see their TODOs, code inspection warnings, include references in code refactoring etc):
You can just add it as an additional Content Root: Settings/Preferences | Directories. Folder added this way will be treated as a part of the project itself and will be shown as a separate node in the Project View panel (just as the main code, which is a Content Root as well).
Or you can open 2nd project while 1st one is already opened and when asked, just chose "Attach":
It's not going to be full 2 projects in one frame, more like something in between attaching Content Root and having 2 projects opened in separate frames.
https://www.jetbrains.com/help/phpstorm/opening-multiple-projects.html
Simple symlink will also do the job (but you need to place it somewhere in a project, e.g. PROJECT_ROOT/libs/my_symlinked_code). You then will need to provide a path mapping for that folder for debugger (if you will debug it of course) as PHP/Xdebug works with "final/resolved path" while IDE works with the path as is.
If you do not need to actively edit that extra code in the same window (and ignore any TODOs, code inspection warnings and other inspection results etc):
Do it as a composer package then? Composer can use custom sources (e.g. GitHub repo or a folder on a local filesystem).
Just add the path to that folder as a "Include Path" at Settings/Preferences | Languages & Frameworks | PHP --> Include Path tab. Code referenced this way is meant for 3rd party libraries (the code that you just use but not edit, e.g. framework code, your send mail/ORM library etc). Composer packages will also be included here by default.
https://www.jetbrains.com/help/phpstorm/php.html#include-path-tab

PhpStorm 10 Download to Library issues (JS yes, CSS no)

I'm just wondering how I can customize the part where PhpStorm allows only to d/l jQuery or other related scripts into library, yet no CSS option to d/l into library.
Of course that the solution is to create a new file > copy the name of the filename > paste it into the name > copy the contents of the bootstrap.min link, paste it in the new created file.
I'm trying to get an automated "d/l into library" option working for CSS, which is pretty cardinal, considering the fact that no bootstrap class hinting will appear in PhpStorm until you have a local/cached library for bootstrap
This functionality is not yet implemented (latest stable is v2016.2).
https://youtrack.jetbrains.com/issue/WEB-10023 -- watch this ticket (star/vote/comment) to get notified on any progress.

Add containing folder to project in PhpStorm

I'm developing a plugin for Moodle and created a project inside my Moodle installation. I'm extending a class called block_base but PhpStorm says undefined class block_base. My guess is that is because all the moodle files (including the class block_base) aren't in the project files.
How do I add this to the project files? I could just simply make the entire Moodle installation the project but I don't want that because i'm using GitHub and I then have to put all of the Moodle files on there as well and that is just pointless.
PHPStorm can handle multiple git roots within a single project (this is how I manage my plugins).
So, you can do the following:
Check out a copy of the main Moodle repo (from git#github.com:moodle/moodle.git)
Put your plugin (including the .git subdirectory) in the correct place in the Moodle code
Set the whole of the Moodle code as the project for PHPStorm
Go to File > Settings > Version Control
Usually PHPStorm will (at the bottom of the dialog) display a list of detected git roots and you can just click 'Add root'. If not, click on the '+' on the right and add the path for your plugin.
Now, you can make changes to your plugin and update, without having to check in a full copy of Moodle (as an added bonus, it makes it nice and easy to pull the latest Moodle code, so you can test your plugin against upgrades).

Including projects in other projects in PHPStorm

Say I am working on a couple of PHP projects named Framework and Application, where the latter is using the former. When I dive in the Application's classes, I see some of them extending Framework's classes, for example:
class Application_Controller extends Framework_Controller
When I hover mouse over Framework_Controller and click Ctrl, I want the name to become clickable link upon clicking on which the source code of the Framework_Controller class from the Framework project will be opened.
Currently I have achieved almost the same thing by adding the Framework codebase path to the "Include path" list (having the Application project opened, go to File/Settings/PHP). The Framework codebase tree appears under "External Libraries" in the Project window. So when I click on Framework_Controller as described above the Framework_Controller class file gets opened indeed. However, PHPStorm does not take into consideration that the file actually belongs to another project named Framework — it just opens the file. This has the following disadvantages:
On the top navigation bar, the full path to the file is shown (i.e.
starting from "/") rather than starting from the Framework project
root directory.
If I want to edit the file (and possibly more related files in the Framework codebase), I would have to manually switch to the Framework project window and find the same file in there.
So I am wondering if there is any way I could tell PHPStorm that the Application project uses/includes the Framework project, so that when I click on Framework_Controller as described above, the Framework_Controller class file gets opened in the Framework project window rather than just a file external to the Application project.