GrabDuck

PhpStorm for Users of Eclipse PDT and Eclipse-based IDEs - PhpStorm - Confluence

:

 

This is a guide for Eclipse PDT and other Eclipse-based IDEs (such as Zend Studio, Aptana Studio, etc) users coming to PhpStorm. It summarises the main aspects that make PhpStorm different from Eclipse platform and helps you get accustomed to PhpStorm quickly.

Further reading: Getting Started with IntelliJ IDEA as an Eclipse User by Anton Arhipov

Getting Started

What configuration is needed before start?

A lot of PhpStorm features are available without any configuration right after launch of the application, though in order to take advantage of running your PHP application, you need to configure PHP interpreter & server.

If you plan to launch the application locally, you need a PHP engine installed and registered in PhpStorm and a Web server installed, configured, and integrated with PhpStorm. You can install these components separately or use an AMP package. Read more about initial interpreter/server configuration.

If you are going to run and debug an application directly on a remote host, the only thing you need is register access to this host in PhpStorm to enable synchronization.

Please refer to QuickStart Guide for more information on getting started.

How can I open an Eclipse project in PhpStorm?

You should create a new project from existing sources. In most cases moving the project to PhpStorm is not a complex operation, you can create a new project from existing sources using the File | New Project action or from the Welcome screen. PhpStorm can use the same directory as your Eclipse project is using. PhpStorm then adds .iml file (idea module file) and .idea configuration directory.

Some of the most common steps required during import include: deployment to remote host, configuring and using debugger. These steps are described in the FAQ entries below.

See Project concept for details.

Where are my Workspaces in PhpStorm?

In Eclipse, a workspace is a logical area where developers manage a number of different projects. Each project, in turn, is made of source files, libraries, user libraries and dependencies on other projects.

To cover a similar use case PhpStorm allows you to work with multiple projects opened simultaneously.

More in general, in PhpStorm you can achieve the same results as in Eclipse in terms of the project configuration.

How can I open a few projects in PhpStorm simultaneously?

It's possible to work with multiple projects simultaneously using PhpStorm. To achieve this you only need to open a project, while another one is already opened, and choose Add to currently opened projects.

How to start with deployment to the remote host?

If you've checked out your project from the remote host, deployment server is already configured. Otherwise, you will need to get it configured (it can be FTP/SFTP/FTPS server or mounted/local folder) in Settings / Preferences | Deployment.

Remote host tool window is available on the right of the PhpStorm window which is handy to browse through remote server and perform various actions.

Make sure to check full tutorial on deployments in PhpStorm.

How to start with debugging?

PhpStorm comes with support for both Xdebug and Zend Debugger for debugging and profiling. There is a zero-configuration debugging workflow available which means that the only things you need to do are:

  • Press Start Listening for PHP Debugging Connections button on the toolbar of the IDE.
  • Put a breakpoint in the file (clicking on the left gutter next to the line).
  • Start debugging in the browser using plugin or browser bookmarklets.

The Run button is disabled when I start a new project. How do I run my application?

The reason for your Run button to be disabled is that there is no Run/debug configuration defined.

Run button will be available as soon as you configure run/debug configuration using e.g. PHP Built-in web server or remote server.

Use the action Run | Edit Configurations or use the Run Configurations box in the IDE toolbar. Use the + sign to add a new configuration and choose how you want to run your application.

How to start with VCS integration?

Most popular Version Control Systems are supported by PhpStorm, including Git, Subversion, Mercurial, Perforce, CVS, TFS, and more. VCS integration for the project can be configured in Settings/Preferences | Version Control.

Read more about Version Control Support in PhpStorm.

Where can I find the "Options" dialog?

The options dialog is called Settings/Preferences dialog in PhpStorm, and is invoked by File | Settings / PhpStorm | Preferences command on the main menu. You can configure global PhpStorm settings here as well as many project-related settings. Note that you can use the search functionality to quickly find an option — this is very practical because there are many options to configure.

Does PhpStorm support Auto-Save of Files?

With PhpStorm you never need to worry about saving your files when you switch to another application, run your code, perform a VCS operation and so on. Files are saved automatically on every frame deactivation. In addition, as an additional safety measure, you can enable auto-save if the application is idle for a specified period of time. By opening the Settings/Preferences dialog box, you can change the auto-save period in the General tab. In case you need to roll back any unwanted changes, you can use Local History - built-in version control system.

How do I define Shared Project Settings?

In PhpStorm a number of customizable options can be set at the project level. The list includes Code Style Settings, Run Configurations and Inspection Profiles. By defining these settings at the project level, you instruct PhpStorm to store them in the project description file and keep them global and then available to all team members.

How can I apply Eclipse Code Styles to PhpStorm?

There are two approaches to import the Eclipse code styles in PhpStorm.

  1. A developer on the team takes the burden of configuring his own instance of IntelliJ IDEA based on whatever collection of settings the team agrees on, including the common settings of Eclipse.
  2. You can install the following PhpStorm plug-in: Eclipse Code Formatter. The plug-in lets you use the Eclipse's code formatter directly from PhpStorm. In doing so, it solves two problems at the same time. First, it lets developers to work in PhpStorm with the same code style they were used to in Eclipse. Second, it helps maintaining a common coding style in collaborative environments where both PhpStorm and Eclipse are used.

Because at the end of the day both IDE save current settings to a local XML file, a smart tool can read one file and convert it to another schema automatically to the extent that it is possible. This is precisely what the aforementioned plug-in does: it reads the settings of a given Eclipse project and imports those settings into the PhpStorm local file storing settings.

How can I run/debug HTML with JavaScript?

Just like when editing PHP code, PhpStorm comes with a rich editor for HTML, CSS and JavaScript. It comes with code completion, formatting, intentions, navigation and so on. The IDE not only completes HTML elements, it also does this for attributes and files we may want to reference.

While working on a document, we can quickly open it in a browser to see the result of our carefully crafted HTML. All we have to do is pick our browser of choice after hovering over our document (or press Alt+F2 and pick from the list).

To debug JavaScript with PhpStorm, a Chrome JetBrains IDE Support extension is used. This extension provides the link between what happens in the IDE and what happens in the browser, and vice-versa. We may have to install this extension manually.

When we've installed Chrome extension and added a breakpoint, we can start a debugging session. This can be done by creating a JavaScript Debug Configuration, something we can do manually from the toolbar, or by using the context menu on the file we want to debug and clicking Debug '<filename'>. Read more about JavaScript debugging.

Can I use Eclipse keybindings in PhpStorm?

PhpStorm has its own keyboard shortcuts but also allows you to choose from a variety of alternate keymaps from a few popular IDE's including Eclipse, Visual Studio, and EMACS. A keymap is simply a list of bindings established between a keyboard shortcut and a command available from the IDE. For this reason, two keymaps may be fully comparable only if both IDEs expose the same set of commands.

To activate Eclipse keymap, go to File/PhpStorm | Settings / Preferences, then IDE Settings | Keymap and choose Eclipse or Eclipse (Mac OS X).

You can always re-configure hotkeys or create your own custom keymap. Please refer to the section Configuring Keyboard Shortcuts for details.

We would recommend you to begin getting acquainted with PhpStorm keymap printing the default keymap reference.

Can I enable "mark occurrences" in PhpStorm?

Yes. You can enable this features by selecting the check box Highlight usages of element at caret in Settings/Preferences | Editor.

Refer to the section Highlighting Usages for details.

Is Virtual Space enabled in the editor?

Yes. In Eclipse, the editor virtual space is disabled by default; in PhpStorm, instead, the setting is enabled by default. To change the setting, go to Settings/Preferences dialog box and select the Editor node. In the right pane, you just uncheck the Allow placement of caret after end of line option.

Does PhpStorm support Code Templates (snippets)?

Yes. Code templates are predefined code snippets invoked by typing an associated abbreviation.

In PhpStorm, you configure code templates through the Settings/Preferences dialog. Select Live Templates from the IDE Settings block. Using the controls on the right you can add and remove code templates.

The most notable difference between code templates in Eclipse and PhpStorm is in the bag of predefined templates you find out of the box in PhpStorm.

Learn more about PhpStorm plugins here.

Where can I find useful plugins ?

You can install plugins right from the IDE using the Settings / Preferences dialog. In the IDE Settings section, open the Plugins page that shows plugin that are currently installed. Click the button Browse repositories... to see which plugins are available in the online repositories. Click the button Install JetBrains plugin... to use plugins from the JetBrains repository.

Please refer to the section Managing Plugins for details.

Is there a platform similar to Eclipse platform available from JetBrains?

Internally JetBrains uses IntelliJ IDEA platform for its products — for example, PhpStormWebStormRubyMine, PyCharm, AppCode, CLion, and MPS are built using the same sources as IntelliJ IDEA. It's possible to use the IntelliJ IDEA platform to build your own applications.