Refactoring a large PHP codebase – where do you start?

If you are finding a codebase less manageable than it should be, chances are that refactoring could help. But where can you start? I’ve found the following tools are good for focussing on the areas of code that require attention:

PHPMD – http://phpmd.org/

PHPMD (Mess Detector) scans your source code and computes various quality metrics such as cyclomatic and NPath complexity. These metrics can be used to assess which classes in your codebase need refactoring.

phpcpd – https://github.com/sebastianbergmann/phpcpd

phpcd (Copy Paste Detector) scans your source for code clones — identical fragments of code that are usually created by copying and pasting. Source code with high levels of clones may benefit from refactoring.

What are your favourite tools to help in your refactoring efforts?

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.