icon sc-linkedin logo of codepen-icon logo of github-icon youtube play button

notes by Adam Sullovey

web & mobile application developer
practicing in Toronto, ON

Splitting PHP class files for PSR-0 compliance

Have a ton of classes in one file that need to be split up? Check out Matthew Turland’s class splitter script.

Put it in a folder somewhere in your computer, open up a terminal in that location, and then use it like this:

php php-class-splitter.php /path/to/file/with/lotsofclasses.php /path/to/new/class/directory

It is likely that you will end up putting your new split classes in the same location as the original file. If you are going for PSR0 compliance, you will need to add a namespace to each class after.

comments powered by Disqus