PhpStorm is probably one of the most used IDEs in the TYPO3 world, if not also in the PHP universe. In this post I show some hints, how to work more productively and get more out of it.

In the first part of this post I will focus on the built-in stuff of PhpStorm. The second part is about plugins, which are helpful to work with in TYPO3 context.

Keyboard shortcuts

Using keyboard shortcuts can save much time, but it is hard to keep the overview and to remember all the different shortcuts. The old school way is to keep a printed cheatsheet at your desk. Jetbrains provides a pdf file, that contains all the default shortcuts for Windows, Linux and Mac at https://resources.jetbrains.com/storage/products/phpstorm/docs/PhpStorm_ReferenceCard.pdf.

Besides that they created a nice section in the documentation about mastering keyboard shortcuts. It is really worth to check it out. In preparation of this post, I discovered there two shortcuts, which make the life easier.

Search menu actions

With the shortcut Cmd-Shift-A on Mac or Ctrl-Shift-A on Windows and Linux you can search for all actions, which are available in the menu of PhpStorm. If there is a keyboard shortcut for it, this is displayed at the right border of the popup. So you can learn, the shortcuts while working.

Navigate between tools

Usually several tools windows are open while development. Some are reachable by a keyboard shortcut like Cmd+<number> and some not. Additionally it is not so easy to switch between these tool windows and the open editor tabs. This is where the shortcut Ctrl-Tab comes in. It opens a popup showing all tools and editor tabs. Hitting the tab multiple times switches between the tabs or tool windows.

Live Templates

Live templates are code snippets, which can be inserted by just a few keystrokes. A example is to insert a debugging statement by typing
vd Tab

instead of the long line
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(, __LINE__ . ' in ' . __CLASS__ );
(in my case). It is much faster and less error prone.

Live templates are context specific. That means you can use the same abbreviation in different file formats. F.e. the above live template can expand to the mentioned line in php. In fluid context it can expand to <f:debug></f:debug>. In both cases you get a debug statement without the need to remember two different shortcuts.

You can add, edit and remove live templates in the preferences window under Editor => Live Templates.

If you are working with a team and you want to share the live templates, this is possible by adding read-only repositories to your configuration. More details are available on https://blog.jetbrains.com/phpstorm/2018/10/sharing-code-snippets-in-phpstorm-easy-way/.

Exclude directories from indexing

When you open a project with PhpStorm all files within a project are indexed to make the navigation faster. In TYPO3 projects there is normally also the fileadmin, uploads and typo3temp, which are not needed in the IDE. Also the TYPO3 source is indexed twice in a symlinked environment, making the startup of a project slower.

These directories can be excluded from indexing via the context menu in the file browser by right clicking the folder name and then selecting Mark directory as => Excluded. From the next startup of the project these directories will be ignored.

Quality tools support via composer.json

PhpStorm supports now the use of the PHP Code Sniffer (php-cs) and PHP Mess Detector (phpmd) with nearly zero configuration. Just add it into your project via composer. json and activate it in Languages & Frameworks => PHP => Quality Tools. From 2018-3 on PhpStorm also supports the php-cs-fixer. It allows to fix all code formatting violations for a complete file at once without a manual interaction.

Git client

There is also a very good git client built into PhpStorm. You can reach it via Cmd-9 on mac and Ctrl-9 on a windows and linux machine. I tried it out in the last days and I must say, I could do everything, I needed to do. There are probably some scenarios, where it has its limits, but for everyday life it saves an additional program on the desktop.

Plugins

Plugins are flexible way of PhpStorm to extend the functionality of the IDE. Many plugins are shipped with the IDE, but there are also third party plugins.

TYPO3 CMS Plugin

The first plugin I want to mention is the “TYPO3 CMS Plugin”. It supports TYPO3 development by

  • providing several type providers for $GLOBALS sections or ObjectManager::get
  • generating ViewHelpers and ActionControllers and
  • generating fluid styled content elements

The plugin is developed by Cedric Ziel. Thank you, for all efforts you put into this plugin and making our developer lives easier. If you use this plugin, you should consider sponsoring the development via Patreon or Paypal.

TypoScript and Fluid Plugins

These plugins support you while working with TypoScript and Fluid templates. They provide autocompletion and syntax checking. Furthermore they allow an easy access to documentation and jumping to related files. This sounds all quite simple at the first sight, but it eases the daily work very much. The plugins are available for free via the PhpStorm Plugin Marketplace. If you want to support the further development, remove the ad after 25 restarts and support open source development, you can buy licenses at https://shop.sgalinski.de/products/.

Ignore Plugin

The ignore plugin supports the syntax highlighting within several ignore file types. The ignored files and directories are colored in the project view, so you can see directly which files can be modified within the project and which are third party stuff. Especially if I have many third party apps installed in a project, it eases the orientation in the project view very much.

Markdown and rst Plugin

PhpStorm comes with a native markdown plugin, that shows a live preview of the written text. IMO it is really helpful to get such a visual feedback while editing, even it is not exactly the same as at the target, like the Readme at github.

There is also a plugin for rst, the most used file format for docs in the TYPO3 world. It should support a dev, while writing the documentation. There are icons in the IDE, that split the editor window in an editing and a preview section. This section is always empty (at least in my case). If you have any hints, how to get it running, please leave it in the comments.

Remove plugins

Many plugins are delivered with the factory preset, but not each and every one is needed for your daily work. My recommendation is to review the installed ones and deactivate those, which are not needed. This should speed up PhpStorm and reduce its memory consumption.

Conclusion

While checking out the features and possible links for further reading, I discovered more and more nice things about PhpStorm. I think it is also worth to check out the official documentation at https://www.jetbrains.com/help/phpstorm/meet-phpstorm.html.

I hope, that one or more tips raised your interest. If so or if you know somebody, who could profit from it, please share this post via your favorite social network.

Credits

I want to thank my supporters via patreon.com, who make this blog post possible. This time it is Stephan aka @kaffdaddyThank you very much for your support!

If you appreciate my blog and want to support me, you can say “Thank You!”. Find out the possiblities here:

I found the blog post image on Unsplash . It was published by Max LaRochelle under the Unsplash License. It was modified by myself using pablo on buffer.