There are many complaints about PHP, and even these complaints come from many smart people. When Jeff Atwood writes down another complaint about PHParticleAfter that, I thought about the good aspects of PHP.
The biggest problem with these complaints is that they come from a lot of people who are still using older versions of PHP. They may be unwilling to care or they may be unwilling to admit that PHP is evolving at a very fast pace, both at the language level and at the community level. In fact, it evolves faster than any other language or web platform. Although not always the case, PHP has gone through an amazing journey over the past five years.
Before talking about the amazing achievements of the PHP community recently, let’s take a look at some interesting numbers: PHP is used by 77.9% of websites known to the server programming language. Wordpress is used by 16.6% of websites around the world. The three CMS website building systems with the highest usage rate are: the first Wordpress share is 54.3%, the second Joomla share is 9.2%, and the third Drupal share is 6.8%. All three products are written in PHP.
PHP must have done something right, didn't it?
Now, let me tell you, the unique skill of PHP is: despite years of changes, PHP is still the easiest language for non-technical personnel to learn. It allows people to build dynamic websites faster than other technologies and host websites without hassle. PHP may not be the best language designed in the world, but it is unquestionable that it allows you to get things done.
PHP language
PHP5.0 (released in 2004) brings a very practical object model...and so on, I'm talking about something released 8 years ago. Fast forward to the current PHP5.4, the recent version of PHP, bringing what you dream of for modern web languages: Yes, PHP supports namespaces; Yes, PHP supports closures; Yes, PHP supports traits.
Although it takes some time, PHP 5.4 brings some syntax sugar to make the overall experience better than before: Yes, PHP supports defining arrays with [ ]; Yes, PHP supports newly created objects to call functions like this: (new Foo())->bar(); Yes, PHP supports arrays to get elements like this: $foo->bar()[1].
PHP even learns from the mistake it has made itself: register_globals and magic_quotes are completely removed.
PHP has a built-in web server for local testing, which can be started at microseconds.
Next challenge: How do we update the tutorial on explaining PHP on the Internet? What is the best technology to support WebSocket in PHP programs?
PHP Ecosystem
It's great to have a good language, but it's better to have a good ecosystem. The PHP ecosystem has evolved a lot over the past few years.
Git
I don't want to talk too much about Git, Git is used everywhere, and PHP quickly embraced Git. Almost all PHP class libraries, frameworks, and products use Git, including PHP itself.
Composer
Two years ago, I wanted to remove my ugly PEAR code from hacking in symfony 1 to support plugins. I wanted to replace it with something that can manage project dependencies instead of a PEAR-like installation, so I tried to find the best algorithm that can manage software dependencies. I've tried almost everything possible: from Perl to Ruby, from Debian to Redhat. The result was nothing that satisfies me, only my own solution happened to work... Of course, this is just my experience. I stumbled upon it laterZYpp, that's it. ZYpp useBoolean satisfactory issuesSolution to manage dependencies. ThanksNils AdermannandJordi BoggianoWith hard work, PHP now has a good management dependency tool –Composer。
Yes, PHP has better dependency management tools than other languages.
Thanks to Git, Composer, and PHP built-in web server, it is easier for us to download/test/install a PHP project.
Want to test Symfony (using PHP5.4)?
$ create-project symfony/framework-standard-edition
$ cd framework-standard-edition
$ ./app/console server:run
Want to test Silex?
$ create-project fabpot/silex-skeleton
$ cd silex-skeleton
$ php -S localhost:8888 -t web/
Don't know about Composer yet? You should know about it.
Browse the main Composer repositoryPackagist, it already has more than 1,900 packages, and they have been installed millions of times in less than three months.
Next challenge: Built-in Composer in the next PHP version?
cooperate
Community cooperation is the focus of this article and is also what I am most proud of. We are beginning to see better collaborations in PHP projects, even big ones, so big that you can ignore other projects.
phpBB, Drupal, ez Publish, Symfony, and many other projects (such as phpDocumentor, PHPUnit, Behat, Zikula, Propel, Doctrine, Midgard, etc.) are sharing code. Yes, they are competitors to each other, but they all understand that it is important to work with each other. Composer can promote this collaboration well.
Next challenge: convince more projects to join this trend.
in conclusion
Let me reiterate that PHP may not be the best programming language, and I was the first to say its weirdness, but PHP is by far the best web platform.
Translated from:PHP is much better than you think