6

I'm trying to switch to an IDE for my PHP projects and I'm having problems with refactoring things like filenames etc.

Does anybody have experience with the PHP Refactoring Plugin For Eclipse PDT? Are there better refactoring solutions for PHP? It doesn't have to be for Eclipse, I would try other IDEs.

5 Answers 5

5

The best solution for refactoring in PHP is engineered by Zend, the company behind PHP.

They offer an enterprise bundle of Eclipse PDT with a set of feature-rich proprietary Zend enhancements. It's marketed under the label "Zend Studio" and used by professional PHP developers.

Download a free trial and see how Zend Studio boosts your productivity. It has more relevant PHP features than any competitor, incl. out-of-the-box Team Collaboration (GIT, GitHub, SVN, CVS), integrated PHP and JavaScript debugging, profiling, code inspection & quick fix, test generation & reporting, and others.

For instance, see Zend Studio in comparison to Eclipse PDT Project.

I've been using the product for already 5 years to my full satisfaction. It is something to consider if you're after enterprise PHP development, or a beginning developer who wants to become a pro.

Refactoring in Zend Studio has exactly what you are asking for, i.e. when you rename a file, it scans all files for references, automatically proposes changes to the includes and then applies changes after your confirmation. In addition, I've observed many uses for the feature which takes you straight to the body of a function on CTRL+click. This is extremely useful when changing function names, variable names, and bodies. Zend Studio again scans all files, builds a cross-reference table, and does all changes for you.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, i hoped to get something free, but as it seems there is nothing free for PHP. I just wanted to work like in Java, because it's very comfortable. I will try Zend Studio the next days, but for my current project i have to do it a little bit more oldschool then, like i did in normal texteditors. Search & Replace!
2

Don't use the PHP Refactoring Plugin. It's never gotten out of alpha, there is no release to download and the only access to it is through it's subversion repository. And there are no commits the repository in a while, so the project is essentially dead.

There is some minimal refactoring support in Netbeans:

Rename Refactoring You can rename an element such as a class name across all files in a project. The feature forces you to preview your changes before you can make them. The preview window shows you every location of the element and lets you exclude individual occurrences of the element from being renamed. Rename Refactoring is contrasted with the older feature, Instant Rename, which lets you only rename an element within a file and which does not provide a preview window.

And Netbeans is as good a choice for a PHP IDE as any. PHPStorm also supports some refactoring functionality:

The Rename refactoring works for files, functions, constants, classes, properties, methods, parameters, and local and global variables.

Also following refactorings are available:

Introduce Variable Introduce Constant Introduce Field Inline variable Make global project changes easily and safely. Local changes are made instantly in-place.

But PHPStorm is not free.

There are quite a few non IDE refactoring tools for PHP in this related question.

4 Comments

I tried Netbeans for PHP now, but i still got the same problem: When i rename a file, i have to manually edit each include. Am i doing anything wrong or do i still have to live with that?
@sewo You're not doing anything wrong, unfortunately. Although they claim that The Rename refactoring works for files and what you describe is a very essential "file refactoring" feature, it doesn't work. As a quick work around, you could do a search & replace in project (ctrl-shift-h) or a file search (ctrl-h) in Eclipse. If you do it in Eclipse it's a two step process, first search in files and then "replace all" from the context menu (right click) in the search results view.
I tried also PHPStorm now and i like it. I will apply for a "classroom licence", thank you for that tip
Got no classrom licence, so turned back to netbeans and got used to it. Search & Replace rules!
2

If you want to spend a bazillion dollars for a copy of Eclipse with a green theme (Zend Studio), their refactoring is decent. It doesn't justify the cost of ZS, though (nothing does IMO).

Comments

1

It's time to upgrade this thread. Eclipse PDT since 3.4 (Eclipse Luna SR2 4.4.2), have built-in refactoring support, moved directly from Zend Studio.

https://wiki.eclipse.org/PDT/NewIn34

Comments

0

Use Netbeans free and powerfull only test it one time

php ,jquery , javascript , and ... the next step will be HTML5 supporting (version 7.3)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.