Using PHPStorm IDE

From Littledamien Wiki
Jump to navigation Jump to search


Overview

Notes about using the PHPStorm IDE, which has some features that are not entirely intuitive to use.

Comparison to NetBeans

So far, every feature that I liked about NetBeans is available in PHPStorm. PHPStorm's performance seems to be much better than NetBeans.

Working with a local network repository

One of the reasons for NetBeans' slow performance might have been that I was accessing the files directly off the local network share.

While it's possible to do this also with PHPStorm, there are some useful features that are unavailable, plus the performance for searches, etc. is much slower.

TK: document creating a new project where project files already exist on a network share.

SQL

Executing SQL from .sql files

  • Either select the .sql file in the Project pane, or open it in the Editor pane.
  • right click' > Run [filename.sql] (Ctrl+Shift+F10)

Viewing data retrieved with a SELECT statement

  • Open the .sql file in the Editor pane
  • Alt+Enter > Run Query in Console
  • The results will be displayed in a tab in the Database Console pane.[1]

Deployment

Creating a new deployment target

This can be done multiple ways.

Through the Tools menu

  • Tools > Deployment > Configuration
  • Click the + button
    • Connection tab
      • Type: Local or mounted folder
      • Folder: (Navigate to remote folder. It must be mounted as a local drive.)
    • Mappings tab
      • Make sure that at least a slash is entered into the Deployment Path field.
    • Excluded Paths tab
      • Enter any local or remote paths that should be ignored as part of the sync.

Through the project settings

  • File > Default Settings (Ctrl+,)
  • Left column > Build, Execution, Deployment > Deployment
  • This opens up the same dialog described above.

Accessing remote servers

If a remote server has been configured, but is not showing up in the list of servers for syncing or uploading, the cause is most likely that mappings have not been created between the project and the remote server.

  • Tools > Deployment > Configuration
  • Select a remote server in the list
  • Mappings tab
    • Confirm that there is a value entered for Deployment path on server
    • Enter "\" to use the root directory on the server.

Syncing with a remote server

In the Project pane' click on the project's root node.

With the project root node selected, either right click > Sync with deployed to… > Choose server to sync with —or— Tools > Deployment > Sync with deployed to…

This will open a Diff Between dialog that lists all the files that differ between the local project and the remote repository.

Arrows will indicate if the sync operation will upload or download the newer version of a file. Right click on the arrow to change the status, e.g. a red X for Set Delete or a blank space for Set Do Nothing.

The pane in the lower half of the dialog displays the differences between the files.

After reviewing the files that differ, either click the single arrow to sync a single file, or the double arrows to sync all the files in the list.

Excluding files and directories from sync operations

Remote host
  • View > Tool Windows > Remote Host > select host from dropdown
  • right click on files or directories to exclude > Exclude Path
Local project, for all remote hosts
  • Project pane > select a file or directory > right click > Mark Directory As > Excluded
Local project, for a specific remote host
  • File > Settings > Build, Execution, Deployment > Deployment > select remote host from list > Excluded Paths tab
  • Add local path button
    • Click the button to the right of the path field.
    • Select the file or directory to exclude.
    • Hit the Enter key

Notes

  1. Running SQL scripts - JetBrains