I am not language agnostic! I think that PHP is the best for web development (and if it`s not web development I am not even the slightest interested….). My saying is “Anything is possible on the web”, and PHP supports that! Inspired by @coderabbi`s talk at PHP UK Conference about user groups, I started KristiansandPHP in 2015. My mission is to spread the knowledge and awareness of PHP in my area (Kristiansand south in Norway).
Why do I prefer PHP?
PHP is a fast (thank you PHP7-team!) and simple scripting language. You can have a small application in one PHP file, or you can have a large system with thousands of files. PHP is designed primarily for web development, it is not something that is added on top of a generic language. I don`t need to think of pointers, memory leaks, garbage collection and all that boring stuff, but I can consentrate on the user request and the respons that is expected
Online resources
Documentation is an important aspect of programming. To be honest I am quit dependent on online resources (blogs, forums, documentation etc), and I`m happy to say that when it comes online resources, PHP is the best! It is easy to find good code examples, and excellent explanations.
Don`t reinvent the wheel
There are many handy functions and features in PHP, for handling strings, arrays, json, xml, files, datatabases and so on. And most of us use a framework (i.e. Laravel or Symfony) that gives you even more out-of-the-box. And if you need even more, then Composer makes it really easy to include other components. There are components for logging, UUID, image manipulation, routing, events, backups and so on. And if you want async there is no need for a other language, because PHP has that too – actually we have several projects for handling asynchronous requests.
We got frameworks!
Just like most modern langugaes, we got frameworks: Zend, Symfony, Laravel, and a bunch of others. Laravel is for RAD (rappid application development), you can quikly spin up a prototype to have proof of concept, and then you can continue in the same framework and build the finnished product. If you have a large database in production, you might be better of with the Symfony framewok (I use both..). I have friends using Zend Framework for both small and large projects, and would never dream of using anything else. I used to think frameworks would quicly get me almost finished, but never match requirements 100%, but after using frameworks for several years,
Frameworks give you a lot out-of-the-box features, it gives your code struckture, and it helps you with the things like CSRF, XSS, SQLinjcetion, dependency injection, validation and so on, the things you don`t want to be bothered with…
I am never going back to writing everything my self, it`s a waist of time and money. What ever your preferances and needs are, there probably is a good framework out there for you!
The right tool is half the job
When your codebase is large and complicated, it can be hard to find bugs. luckely we have Xdebug, that Derick has maintained since 2002! I use it every day, it is my first tool when trying to figure out a bug, and the integration with IDE`s like PhpStorm is superb!
And don`t forget testing! There are many ways to do testing in PHP, i.e. PHPUnit for unit tests, Codeception for function tests, and Selenium for acceptance test, and then there is Behat for BDD. If you don`t run test, you better watch out for a grumpy guy…
PHP is maturing
PHP does not need to be amateur spagetti code that all of us have writen when we were young..
We have standards (PSR), namespaces, type hinting, callables, exceptions, password hashing, interfaces and so on. There are lots of pro features you can choose to use, there is nothing stoping us from making great enterprise solutions!
Say thank you, to contributors!
There are some amazing people out there, that gives talks. document and maintains projects, open source their code, and put up with haters and ungreatful demanding people. Fabien Potencier (Symfony), Taylor Otwell (Laravel), Sebastian Bergmann (PHPUnit), Derick Rethans (Xdebug), Jordi Boggiano (Composer and Monolog), Freek van der Herten (more then150 packages). No one mentioned, no one forgotten. Oops…
Please give something back to them: buy their books, online training, pick something from their Amazone wishlist, or become a patreon. Or at lease give them a “thank you” on twitter.
And thank you Rasmus, for creating PHP, I love it!