A command-line refactoring tool for php5.


If code was just about making computers do stuff naming wouldn't matter. Machines don't really care what you call something — but people do. Good names make code much easier to understand. Bad ones take precious minutes out of your working day while you pause to figure out if class: "Auth" is something to do with authentication or authorisation? Maybe it's both?

Names can be particularly volatile in the early stages of a project. Concepts are refined as you learn about the new domain. Vague ideas come into sharper focus.

How to change them? Renaming a class requires an edit to every file which creates an instance. Renaming a file requires that each reference to the original path be updated. It gets even harder if a core library is used by many client apps and affected files are spread across several different projects, possibly on a range of different machines. If it's open source code there could be a large user base to consider. One small change can start a whole avalanche of trouble.

This is the kind of problem which Rephactor is intended to solve. An automated tool can provide an easy way to make changes which impact multiple codebases.


Note that a program like Rephactor can only carry out basic renaming operations. It will never be able to do anything where human reasoning is required such as "extract subclass".

Changes are applied both to the "primary target" and to any of its client projects, wherever they are. Projects on the local machine are updated immediately and Rephactor scripts can be distributed to other users. This helps free library authors to make changes without having to worry about deprecation cycles.

For the time being Rephactor can only be used with code which is under Subversion version control. It has only been tested on linux.

User Guide

The Rephactor user guide, including installation instructions, can be found here.


You can get in touch via the Rephactor mailing list. My name is Noel Darlow. You might have met me online under the name mcgruff.


A big thank you to the developers of Phemto and SimpleTest, both used in Rephactor. Also the project host sourceforge. Logo