Setting up PhpStorm for use as a FLOW3 IDE - Part II

This second post about using PhpStorm as a FLOW3 IDE deals with setting up a project, as promised in the last post.

Once you've actually created a project (which should be as simple as opening a directory, PhpStorm detects things like the version control system on it's own), you could code away happily. But there are some configuration bits that can make your life easier.

Project directories

First of all you should exclude some folders from the project. FLOW3 creates some proxy classes for runtime use, so for PhpStorm it looks as if classes with the same name exist more than once in the project. This is confusing, to be honest, so it is no wonder that, for example, code navigation sometimes breaks or at least offers you seemingly useless choices.

In the project navigator on the left side of the window right-click on the Data/Temporary folder and select Mark Directory As > Excluded. Starting with FLOW3 1.1 there is one more directory to exclude: Packages/.Shortcuts.

Debugging tips

Debugging is still rather complex, and the fact that a FLOW3 request involves a CLI subrequest for the compile step doesn't make things easier. What I wrote about debugging earlier still holds in essence, so let me point out one major catch of excluding the temporary folder as described earlier.

When running, FLOW3 will use the code in the proxy classes it generated in the temporary folder, the only exceptions are classes for which no proxy building is allowed or needed. The catch is that you will probably set a breakpoint in your source code - and then wait for it to be reached until hell freezes over. That code is never run, the proxy copy is! Ok, the good thing is, you can simply open the class by using the Navigate > Class… command, what you need is the class in the …ClassName_Original.php file.

Here is the second catch: you will not find that file, because you excluded it. The solution, and that is the worst side-effect of the way the proxy building works, is to remove the Data/Temporary folder from the list of excluded folders when you need to debug. This is done in Project Settings > Directories where you see a list of all folder in the project that have been excluded. Simply click the small x next to an entry to remove it.

When done with debugging, exclude it again. Sorry for the hassle, but there is no other way at this time.

Include path

If you want PhpStorm to know about PHPUnit when it comes to code completion, you should tell PhpStorm about your PHP include path. Again use the project navigator and right-click on the External Libraries… entry. Select Configure PHP Include Paths…, click the plus icon and select (or add) the correct include path.

PHPUnit configuration

Setting up PHPUnit for FLOW3 projects in PhpStorm is really simple. All you need to do to get unit tests working is to edit Run/Debug Configurations > Defaults > PHPUnit and set the Configuration file to the Build/Common/PhpUnit/UnitTests.xml file.

Now you can invoke Ctrl+Shift+R on a test class or method as well as on a folder with tests to have them run using the default configuration. Re-running is a simple Ctrl+R invocation.

If you want code coverage information, you need to install the PHPUnit code coverage plugin from the plugin repository and add --coverage-clover /tmp/clover.xml to the Test Runner options in the PHPUnit settings. Then point the code coverage plugin to /tmp/clover.xml as well and you'll have graphical code coverage information in your editor (given you have excluded the proxy classes as described above).

Running functional tests from within PhpStorm can be done by using the FunctionalTests.xml file in the PHPUnit defaults, but I have not yet found an easy way to switch between unit and functional tests at will…


  1. Gravatar

    thanks, helped a lot!

  2. Gravatar

    What about the DebugProxy project ? I have to say that the current debug procedure is the only "bad feature" in Flow. A proper solution to avoid the need to put the breakpoint in the proxy classes can be really usefull and time saving

Leave a reply

Karsten Dambekalns

Creative Code Engineer

Contact / Impressum