Legacy PHP Application: PHP CS Fixer & PHP Code Sniffer for PSR1 & PSR2

Part 1 of this series covers a tour of my 14+ year old legacy CMS called LampLight and it continues with my use of command line code analysis tools to migrate it from PHP v 5.6 to 7.3. In this part we’ll continue to use PHP CS Fixer to clean up the code, and will then move on to use PHP Code Sniffer for even more tidying.

My last few uses of PHP Coding Standards Fixer, are to check for PSR1 and PSR2 compliance. These PSRs cover a baseline of code style conventions common among PHP projects.

Continue reading “Legacy PHP Application: PHP CS Fixer & PHP Code Sniffer for PSR1 & PSR2”

Legacy PHP Application: Code Analysis With PHP CS Fixer

In part one of this series we took a tour into my 14+ year old legacy CMS called LampLight. It’s an oldie but a goodie and it needs some love because it’s still in use by a couple clients and myself. We are migrating it from PHP v 5.6 to 7.3. In this part we’ll use PHP CS Fixer to identify problems and clean things up.

PHP Short Tags and Closing Tags

Talk has been cheap for some time regarding the deprecation of the short opening tag <? for PHP, and its removal has had a few false starts. Finally, a PSR for this change has passed and it will officially be deprecated in v 7.4.

We also want to eliminate the closing PHP tag in files that contain only PHP. These two issues are quite straightforward, so let’s use these as an easy dip-of-the-toe into using command line code analysis tools to have a look at our code. We can even use these tools to make the changes for us.

Continue reading “Legacy PHP Application: Code Analysis With PHP CS Fixer”

Legacy PHP Application Tour & Upgrade

The process of migrating my applications from PHP 5.6 -> 7.3 has been a long one – mainly due to limited time to work on it, and additional tasks being added to the migration list. But I’ve finally made it through the low hanging fruit of easy client sites and am now migrating the first project with a significant amount of back end PHP code. In this case, it’s a legacy CMS I wrote 14+ years ago called LampLight Content Manager.

Continue reading “Legacy PHP Application Tour & Upgrade”

The State Of PHP Today

You may have heard a few rumors going around…

“PHP is just a scripting language.”

“It’s only used by beginners.”

“PHP always ends up as spaghetti code.”

“PHP is insecure.”

“Only the smartest, sexiest people use PHP.”

Ok, maybe that last one was me… but hear me out! Much like the old stereotype of “only nerds play video games”, PHP definitely earned a few unflattering labels many years ago. Times have changed and developers in the know tell a very different story. Just like all the cool kids now play Fortnite (do they? I don’t know), PHP is nearly unrecognisable from its days as the scripting language ‘Personal Home Page’.

Continue reading “The State Of PHP Today”