Dispelling the hate against PHP

Over the past few months I've developed many applications in the PHP framework Laravel. Laravel is essentially a rails-like framework for PHP. I've personally never used Ruby on Rails as I found that installing Rails is a huge pain compared to the simplicity of apt-get install apache2 php5, and figured out that most things that Ruby on Rails can do, Laravel already has it.

Unfortunately simply because it's PHP it puts developers coding in (insert latest trendy language/framework here) off.

PHP is insecure!!!

No. No it's not. PHP is as secure as any other dynamically typed language such as Ruby or Python. If you think PHP is bad, what about some of the huge exploits in rails over the past year, which caused a certain bitcoin exchange to lose a large amount of users funds.

There hasn't been any major security hole in PHP as bad as those for several years now.

PHP has no package manager. Ruby has gems, and python has PIP.

Actually, PHP has evolved a lot, Composer has been around for a few years, and thanks to the growth of Laravel, more and more people are using it. Most packages are already available in composer, and the community is thriving.

Adding a package is as simple as adding the repository name to your composer.json, giving it a version, and then running composer update

    "require": {
        "monolog/monolog": "1.2.*"
    }

Okay, so maybe it's not as bad for developing now, but PHP is slow!

PHP is on par in speed terms with Python and Ruby for most applications. Infact in some cases it's faster than them. If you're comparing PHP to something like PyPy then a better comparison would be to HHVM (Hip-Hop VM).

Thanks to HHVM, PHP can be extremely fast, and it currently has close to 100% compatibility with most PHP packages in composer, including frameworks such as Symfony, Laravel, and Codeigniter.

PHP with HHVM is battle tested and usable in almost all cases now, this has been proven by Facebook, who have created HHVM and are using it in production to run the actual Facebook site.

I'll be posting some statistics soon to show how much of a big difference HHVM made to a certain high-speed gambling site I worked for. (basic info: went from handling over 1000 bets per second per server with nginx+fcgi, to over 50,000 bets per second per server with raw HHVM)

And frameworks?

There's many good frameworks for PHP in 2014. Two of the most popular and up-to-date frameworks are Laravel and Symfony. There a lot of other good frameworks, such as Yii, and CakePHP, but in my opinion Laravel and Symfony are the most feature complete frameworks for PHP at the current moment.

Conclusion

The PHP ecosystem has evolved from the horrid mess it was a decade ago. I recommend that people try it out again with a modern framework, as I've seen many developers who've moved away from PHP to Ruby, Python, and Node, and then came back once they seen how great PHP is with a recent framework which uses all the nice features of recent PHP versions, as well as Hack, Facebooks new language based on top of PHP.