Recently, PHP spread rot to all and sundry, even quite reasonable people. When Jeff Atwood created his next
post against PHP, it made me think about the good sides of this language.
The main problem of all these articles is that the people who write them are stuck in the old days of PHP.
Either they don’t care, or they don’t want to recognize it, but PHP is evolving at a very fast pace, both as a language and as a community.
Moreover, PHP is developing much faster than any other language or platform. Of course, this was not always the case, but the last 5 years have been truly amazing for PHP ...
')
Before we start talking about the achievements of the PHP community lately, let's look at some interesting numbers: PHP is used as the main language for
77.9% of all sites where the platform language is known. Wordpress is used in
16.6% of all sites in the world. If you look at the top 3 CMS, Wordpress comes first with 54.3%, Joomla second with 9.2% and Drupal third with 6.8%. Top 3 products, all written in PHP.
This is not surprising: in PHP, something is clearly done right, isn’t it?
Let me tell you a little secret to the success of PHP: in spite of all the changes in recent years, PHP is still the easiest language for non-technical people to learn; PHP allows you to create dynamic websites faster than any other technology, allows you to raise websites cheaply and without problems. It is possible that PHP is not the best language in the world in terms of design, but it allows you to quickly achieve goals, and you can not argue with that.
PHP: Language
In PHP 5.0 (released in 2004), a stable object model was introduced ... stop. I'm talking about something that was almost 8 years ago. Let's go back to the present.
In the modern release of PHP, 5.4, there are all the buns that you could dream of using the modern web language: yes, PHP supports namespaces; yes, PHP supports closures; Yes, PHP supports traits.
It took some time, but PHP 5.4 includes a bit of syntax sugar, which makes the development process better: yes, PHP supports [] for array designation; Yes, PHP supports calling a method on the created object ((new Foo ()) -> bar ()); Yes, PHP supports invoking an array element from an arbitrary expression ($ foo-> bar () [1]).
PHP learns from its mistakes: register_globals and magic_quotes are cleaned with giblets.
And finally, PHP has a built-in web server that simplifies local testing ... and it runs in a matter of milliseconds.
Challenge for the future: how to “update” all PHP guides on the Internet? What is the best way to support webboxes in a PHP project?PHP: Ecosystem
Good language is cool, but a great ecosystem is even cooler. And the PHP ecosystem has evolved dramatically in recent years.
Git
I will not go into the details of this item. Git is everywhere, and it entered the world of PHP pretty quickly. Almost all major PHP libraries, frameworks and products use Git, including PHP itself.
Composer
Two years ago I really wanted to get rid of the terrible PEAR hack that I used in symfony 1 to support plugins. I wanted to replace it with something that could manage dependencies at the project level, and not have a global installer like PEAR. Dependency management is not an easy task, so I tried to find the best algorithm to solve it. I looked at everything from Perl to Ruby, from Debian to RedHat. Neither was satisfactory — the terms were homemade solutions that simply work ... empirically. And then I came across a
ZYpp . That was it. ZYpp uses a
SAT analyzer to manage dependencies. And now, thanks to the tremendous work of
Nils Adermann and
Jordi Boggiano , PHP has one of the best dependency managers,
Composer .
Yes, PHP is now the best dependency manager from all languages.
And thanks to Git, Composer and the built-in PHP server, downloading, installing and testing PHP projects has not been
so easy !
Want to try symfony (using PHP 5.4)?
$ composer.phar create-project symfony/framework-standard-edition
$ cd framework-standard-edition
$ ./app/console server:run
Silex?
$ composer.phar create-project fabpot/silex-skeleton
$ cd silex-skeleton
$ php -S localhost:8888 -t web/
Composer? .
Packagist — Composer: 1900 3 .
: Composer PHP?— , , . PHP , , , , , .
phpBB, Drupal, ez Publish, Symfony, phpDoc, PHPUnit, Behat, Zikula, Propel, Doctrine, Midgard . , «», — . Composer .
: ?:
PHP, , , , , PHP — … .
P.S. PHP is much better than you think, Fabien Potencier. , , .