Five PHP code refactoring tools recommended _php Tips

Source: Internet
Author: User
Tags php language zend

In software engineering, the term refactoring code usually refers to modifying the source code without altering the external behavior of the code. Software refactoring needs to be done with tools, and refactoring tools can modify the code and modify all the places that reference the code. This article collects five excellent PHP code refactoring tools to help you improve your project.

1. Rephactor

Rephactor is a command-line refactoring tool, an automated tool that allows developers to modify the source code in a different codebase in a neat way.

Main function:

Ensure the reversibility of refactoring-once the problem is discovered, the code is reversible and can be traced back to the previous version.
Find replacements--normal lookup substitution, method renaming, class renaming, and replacement of regular expression patterns.
After all operations are completed, the tests are based on simpletest Aperiplus and the coverage of the tests is ensured.
Integrate Phemto to ensure class correlation testing.

2. Scisr

SCISR is a refactoring tool written using PHP. The project is hosted on the GitHub. Issued under GPL license.

How to use:

Rename of class:

Copy Code code as follows:

$ SCISR rename-class oldname NewName [Files]

To modify the method:

Copy Code code as follows:

$ SCISR rename-method owningclassname oldmethodname newmethodname [Files]

File Rename:

Copy Code code as follows:

$ SCISR rename-file old/file_name new/dir/new_file_name [Files]

To rename a class and file:

Copy Code code as follows:

$ SCISR rename-class-file oldclassname newclassname [Files]

3. PHP Refactoring Browser

This is a refactoring tool for PHP code that describes the steps of refactoring by generating diffs to avoid simple errors in refactoring, which is great. The project is hosted on the GitHub.

Working with libraries:

PHP Parser by Nikic
PHP Token Reflection from Ondřej nešp
Refactoring browser data consists of the following:

Patch--support for creating patches based on changing file operations;
Refactoring--Contains the actual refactoring domain and fit the third party library;
Collection--a reliable addition of the collection semantics based on the PHP array. Currently contains a set of types.

4. Phpstorm

Phpstorm is a PHP IDE rich application developed by JetBrains company, and it supports refactoring. Phpstorm can help users adjust their coding at any time, run unit tests or provide visual debugging capabilities.

Currently, Phpstorm 7 is released, new versions support PHP5.5, improved PHP syntax coloring performance, vagrant, SSH control & Remote Tools, support Drupal & PHP frameworks, and improved debugging and test performance.

Main features of Phpstorm:

Intelligent PHP Coding Editor;
Code quality analysis;
Support debugging/testing;
Support Html/css/javascript Editor;
Support across platforms.

5. Zend Studio

Zend Studio is a PHP language integrated development environment developed by Zend Technologies. Supports HTML and JS tags, but only provides debugging support for the PHP language.

Main Features:

Have a powerful professional editing tools and debugging tools;
Support PHP syntax highlighting, syntax automatic filling function, support syntax automatic indentation and code copy function;
Support Bookmark function;
Built-in a powerful PHP code debugging tool;
Supports both local and remote debugging modes and supports a variety of advanced debugging features.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.