Quick Way to Integrate PhpED and Team Foundation Server

phpedlogo So when I’m asked, “How can I integrate my PHP IDE with Team Foundation Server?”, my first response *should* be, “Why not use Visual Studio instead?”  That’s an idealistic reply, admittedly.  There are several great tools out there for PHP development, with followings that would collectively shudder at the thought of *having* to use Visual Studio.

PhpED by NuSphere is a popular PHP development tool.  It boasts (among a lot of other things) the ability to plug-in to various version control systems, although it comes set up to leverage CVS.    There’s not much documentation out there to explain how exactly to tie into other version control systems besides CVS.  So what about Team Foundation Server?

The fast answer?  Use the TFS Power Tools, more specifically the Windows Explorer extension.  This power tool allows you to perform version control operations on files directly from Windows Explorer:

The TFS shell extension power tool

All that’s really required (besides having the TFS Power Tools installed) is that the files you want to work on reside in a folder that’s in a TFS workspace

If you use PhpED for PHP development, you probably see where I’m going with this.  😉

Let’s say I have the below workspace and project in PhpED:

A sample project in PhpED

I set up this project in C:\Work\NotDotNet\Test, which is already mapped to a TFS workspace.  As soon as I start populating files into this project, I can see that the Windows Explorer extension power tool is already working if I look at the file system:

The TFS shell extension

Now for the fun part.  PhpED has a nifty little feature that allows you to access the Windows shell from within its IDE.  Right-click, select “Shell Menu”, and there it is!

Accessing the TFS shell extension from PhpED

To add all these files to TFS version control, I right-click the project and select Shell Menu->Team Foundation Server->Add.

The “Add to Source Control” dialog pops up:

Add to Source Control dialog

Hit “Finish”, and I’ve added all my files as pending changes to TFS.  Last, all I have to do is check them in by again going to the Shell Menu, only this time selecting “Check In”.

Selecting Check In

That gives me the TFS check-in dialog we all know and love.  I can do everything I normally would with this dialog, such as choosing specific files to check in, comments, check-in notes, and linking to work items.

TFS Check-in dialog

Click “Check In” and I’m done (in my case, check check-in created changeset 270)!

Check-in completed!

BTW, notice I’m getting the TFS version control icons displayed in PhpED (the green triangles in at the bottom-right of an item’s icon indicates it’s “seen” by TFS, a pencil indicates a checked-out file, etc.):

TFS version control icons in PhpED

Now to test that I can check out and check in, let’s make a little change.  (My big preface here is that I know almost nothing about PHP development, so I’m just going to insert some arbitrary text so I have a modification.  This is not a PHP lesson!)

First, I noticed that PhpED won’t even let me modify a file (may be a setting somewhere, but I’m not sure) if it’s read-only.  So that tells me right away that my file is not checked out.

So I check out the file via the Shell Menu extension (Shell Menu->Team Foundation Server->Check Out for Edit).

Checking out a PHP file for edit

Now I can make a small change.

My simple change

Once I’m done making my edits, I save the file and check it in (again using the Shell Menu, you probably get this by now).

Selecting check-in

Again, I get the beloved check-in dialog again.

Check in Dialog

Fill in the information I want, click “Check In”, and  I’m off!

Now, just to make sure I’m not looking at smoke and mirrors, let’s switch to Team Explorer and view the file’s history.

File history in Team Explorer

There’s my change!  Now, for a final check, let me diff the two versions.

Comparing the two versions of the PHP file in version control

Make sense?  Not bad for a free integration point!

Now, this all said, there is one main caveat which is worth mentioning – it shouldn’t prevent you from leveraging this shell-type integration, but it should be known nonetheless.  The TFS Power Tool shell extension only provides the basic version control operations.  Others, such as getting historical versions, viewing history, branching, merging, and shelving are notably absent from the shell extension’s menu.  You can still do all this from Team Explorer – you’ll have this installed on your machine, as it’s a requirement for the TFS Power Tools to be installed.  So yes, for some operations you’ll need to pop open Team Explorer, but the bulk of your daily operations are available right from the shell.

BUT, PhpED is also has a very extensible menu system (that’s how it ties in with CVS), so you may also be able to leverage that to create TFS-specific menu options (such as creating workspaces, diffing files, etc.).  I had a little fun with this and was able to quite easily create a couple of TFS-related menu options to help me view a file’s history, as well as create a shelf.  All I did was drop the path to tf.exe (by default it’s "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\”) into my PATH environment variable (just easier than putting in the full path to tf.exe each time), and away I went.

In PhpED, go to Tools->Settings, then scroll down to Integration under Tools.  Here I created a new menu called “Team Foundation Server” and added a few submenu items with the following options (I’m sure you can figure out how to add a few more if you want):

Option Name Command Options Selected
View History tf history “@FName@”

  • Show this command in workspace popup, for files

  • Show this command in Explorer popup, for files
Shelve tf shelve

  • Show this command in workspace popup, for files, for directories

  • Show this command in Explorer popup, for files, for directories


tfpt annotate “@FName@”

  • Show this command in workspace popup, for files

  • Show this command in Explorer popup, for files

And I end up with this:

PhpED Settings - customized menus for TFS

As you can see, I can leverage the command-line interface for both Team Explorer (tf.exe) and the Power Tools (tfpt.exe, which gets added to your PATH automatically upon installation).

So now, when I right-click on certain objects in PhpED, I can take advantage of these options.  They simply shell out the specified commands and the appropriate CLI takes over.  For example, if I select “View History”,

Selecting the View History custom menu option

I get this:

Viewing History of the selected file in PhpED


So that’s about it!  There of course may be other ways to integrate these two products (perhaps using SVNBridge on CodePlex), but I found this above method to be quick and relatively painless.

I hope this helps a couple people!  Please let me know what you think, or if you have any questions.

Comments (3)

  1. Stuart says:

    Have followed these instructions and have TFS power tools working in windows explorer. However, NuSphere does not pick up the Team Foundation Server menu option under "shell menu" for my workspace.

    Running TFS 2013 powertools against TFS in the Cloud and Nusphere 6.2 on Windows 7.

    Any ideas?

  2. Steven Lange says:

    Hi Kelley,

    The easiest way is to install Team Explorer on your machine to set up your initial workspace mappings.  (You'll have the rights to install Team Explorer if you have a CAL for TFS.)

    BTW – sorry for the tardy reply.  Email notification didn't work for this comment, so I just now noticed it.  Thanks for reading!

  3. Kelley says:

    This would be a fantastic article if you could point me in the direction of how to get over this initial hurdle:

    "All that’s really required (besides having the TFS Power Tools installed) is that the files you want to work on reside in a folder that’s in a TFS workspace"

    How do you create a TFS workspace and link it to a mapped folder on the client machine for non-VS projects (like phpEd)?

Skip to main content