Home / Why PHP is for Real

Why PHP is for Real

PHP has evolved from its humble beginnings as the lingua franca for script kiddies, into a “true” programming language. Nowadays, huge numbers of businesses and organizations of every size depend on code written in PHP.

When you look at the top 10 of most popular programming languages, PHP holds the number 5 position. When we focus on languages used for websites and web applications, PHP is number one. Did you know that 3 PHP developers are listed in the top 10 of most active GitHub contributors?

In this article, I want to touch on a few reasons why PHP is so popular, and why it may be the best bet for your business or application:

  • Long history, high rates of adoption, and rapid evolution
  • The large community of contributors with strong focus on professionalization by the core development group
  • The massive success of 3rd party CMS’s written in PHP like Drupal, Wordpress, and Joomla
  • The new wave of professionalization introduced by 3rd party frameworks like Zend and Symfony
  • Influential companies building their products and applications in PHP and enterprise-level adoption thanks to a range of PHP quality assurance, performance and scalability tools

Podcast Interview with Thijs

Listen to Thijs on the Acquia Podcast, talking about his background and the PHP community in an interview recorded in May 2013 during the joint DrupalCon and Symfony Live events in Portland, Oregon.

Community, Some History, the Future

Community powered

Just like any other successful open source project, the power of PHP comes from its community. The PHP community includes lots of active members who collaborate on the core language, but also on other open source projects written in PHP.

It’s really interesting to see that some derived communities (like the Drupal community with one million registered users on Drupal.org) can attract a huge following, easily exceeding the membership and attendance rates at regular PHP events. The true power of the larger PHP community can only be quantified by considering the size and quality of its various “sub-communities” around applications like Drupal. The sum total is a hard one to match by any other programming language.

Community members meet virtually via mailing lists, IRC channels, and of course GitHub. There are also tons of real-life meetups, ranging from local user group meetings, to hackathons, to full-blown conferences worldwide that attract tens of thousands of visitors every year. The PHP community is a very open one; there is no strict hierarchy. Barriers to entry are pretty low and the community loves welcoming and helping newcomers. We consider ourselves a friendly meritocracy and strive to remain a positive, troll-free zone.

Getting started with PHP the right way - Here’s a great resource for getting started with PHP “PHP the Right Way” (this is a great resource)

Bridging the gap - Drupal

The adoption of Symfony2 components in Drupal 8 is definitely a milestone for the larger PHP community. The Drupal core development community decided to outsource some standard components to the Symfony community rather than continuing to reinvent those wheels.

This is a big deal! These two communities know and respect each other, but haven’t really worked together in quite a while. More up-to-date PHP (and Symfony2) standards will be part of the everyday life of a Drupalist. It means that Drupal’s core will professionalize at the same pace that PHP (and its frameworks) are professionalizing. Drupalists will be able to contribute upstream – Drupal is a very smart and innovative community. Drupal will benefit from Symfony2 and PHP and Symfony2 and PHP will benefit from Drupal’s input and influence.

PHP versions

Getting Drupal 8 onto PHP 5.3 is a good thing, don’t get me wrong, but with PHP 5.5 being stable now, PHP 5.3 has actually gone into end-of-life/security-only mode, so you could say Drupal is a bit behind. Drupal 7 also released on an EOL version of PHP (PHP 5.2 in 2011). On the other hand, the situation for Wordpress and Joomla is even worse: their minimum PHP version is currently 5.2.4.

It’s a pity that the CMS/CMF communities don’t aim for the latest, stable version of PHP when releasing a new version of their software. Although core people within the various PHP communities have the discipline to adopt the features of newer PHP versions, more people outside of the core initiatives need to do so as well.

To be fair, a lot of web hosting companies stick with older versions of PHP and don’t support newer ones. This sometimes forces CMS developers to aim for this lower common denominator, too. From my perspective in the webhosting industry, where the market is very competitive, I can say this is changing. Nowadays, if you don’t support version X or Y of something important, clients are going to shop around and find another hosting provider who can deliver. The CMS/CMF scene needs to realize that they have the power to dictate what hosting providers support.

Versions, features, and backwards compatibility

PHP is a “serious,” and “professional” programming language, evolving at a fast pace. New versions always come with new features and performance improvements. The last huge change was the complete OO overhaul that was introduced in 5.0.

Compared to PHP 5.2, version 5.3 introduced support for namespaces and closures. 5.4 featured traits, the built-in webserver, and leaps in performance. PHP 5.5 is all about generators and native opcache support.

Although PHP generally respects backwards compatibility, there are backwards-incompatible changes in 5.3, 5.4, and 5.5 that you need to keep in mind. The ones in 5.4, for example, tend to be quite severe: no more safe mode, magic quotes, register globals or call-time pass by reference.

Tools and Adoption - a Professional, Enterprise Ecosystem

Frameworks

Ever since the release of PEAR in 2000, it was clear that writing all your code yourself wouldn’t pay off in the end. Component libraries like PEAR or EZ Components were hot, and they were quickly followed by MVC frameworks like CodeIgniter and CakePHP.

The adoption rate of PHP continued to grow in that period and PHP started to be used for more than just simple websites. Large-scale projects were being built in PHP and frameworks were a great relief to those developers. Not only did frameworks improve the time to market of a project, it was a way of “outsourcing” boilerplate code to other communities.

The major breakthrough came when Zend Framework and Symfony were released. Those projects made sure that PHP was ready for the enterprise. Given the fact that both frameworks have released a version 2, they’re both aiming for the long run.

A bunch of projects have been created in the margins of these frameworks and are equally important. Tools like Composer and Twig are great and are slowly becoming industry standards.

The latest trend in the framework scene is that tools and frameworks are building their code on top of other frameworks. The Symfony2 framework seems to be the main influencer here. Drupal 8 is including Symfony2 components is an important step. This kind of collaboration will only make PHP stronger and better.

Quality assurance

To become a mature language, one needs to take quality into account. It’s not just about writing good code, but about guaranteeing that the codebase remains stable throughout its development cycles. We’re mainly talking about testing here.

PHP as a language focuses heavily on testing, and the PHP QA team is responsible for that. They have a continuous integration process where PHP branches are constantly tested. There’s also a code coverage tool that shows the amount of code that is covered by the tests.

In the mid-2000s, quality assurance became a big deal for projects written in PHP, too. The release of PHPUnit, a unit testing framework written in PHP, symbolized that emphasis. Behat, a behavior-driven development framework written in PHP, is also becoming popular.

There’s also a PHP template available for continuous integration with Jenkins. For open source projects, Travis CI is a great solution.

Enterprise grade

There is no reason to doubt that PHP is ready for the enterprise. It is easy to learn and use, has tons of frameworks and other tools to save developers’ time and improve project quality. High profile internet companies using PHP for some of their products include: Facebook, Google, Yahoo, Wikipedia.org, Flickr, Dig, Wordpress.com, Acquia, Etsy, and many more.

A secondary selling factor is the level of adoption by websites in general. According to http://www.php.net/usage.php more than 244 million websites are known to use PHP.

Making PHP go fast

People are sometimes skeptical about PHP’s performance. PHP does carry a legacy that sometimes has a performance impact. However, benchmarks show that its performance becomes notably faster with each release. Using the right tools can make a huge difference.

Part of this performance-affecting legacy is that PHP is a loosely typed language by design. This means variables can have whatever type of value you want. To organize these values internally, PHP uses zval structures to keep track of the value, the type and the reference count. This can consume a lot of memory. Then again, performance mainly depends on the kind of code you run on your system.

PHP offers opcode caching through APC or Zend Optimizer (plus). These types of cache store machine code in memory to avoid having to run the expensive lexing and compilation process each time.

Frameworks are all the rage these days, but frameworks aren’t built for performance. Using a framework can have an impact on performance, too. My main advice here would be to cache whatever you can cache. Using a distributed cache like Redis or Memcached is a valid solution for caching internal data. Caching webpages with a reverse proxy like Varnish or Nginx is also a powerful solution.

I’m not sure what else the future holds in terms of performance, but I’m very curious how HipHop for PHP will evolve.

Conclusion

PHP is a great programming language for the web and is the right tool for the job more often than not. Its broad community and adoption for mission critical use at scale; rich ecosystems of tools, hosting, and frameworks; and powerful CMS’s like Drupal all make PHP an essential part of today’s web.

Reacties

Posted on by karlosss (niet gecontroleerd).

i think mongo has better drupal integration(not only cache) than redis and is better in compare to memcached

Posted on by Susan (niet gecontroleerd).

I agree with Freyn that PHP is awesome and best for web applications. With the help of PHP framework like symfony, PHP has become more scalable, durable and robust. With the Introduction of Symfony 2, we can even use namespace in symfony now.

I have also developed my website (www(dot)allassignmenthelp(dot)com) in php and symfony. Infact used bootstrap framework for some forum.

Posted on by Aimy Wilson (niet gecontroleerd).

Thank you very much for sharing this informative article.The fastest growing technology in the world of web development is PHP.

Reactie toevoegen

Plain text

  • Geen HTML toegestaan.
  • Adressen van webpagina's en e-mailadressen worden automatisch naar links omgezet.
  • Regels en alinea's worden automatisch gesplitst.

Filtered HTML

  • Use [acphone_sales], [acphone_sales_text], [acphone_support], [acphone_international], [acphone_devcloud], [acphone_extra1] and [acphone_extra2] as placeholders for Acquia phone numbers. Add class "acquia-phones-link" to wrapper element to make number a link.
  • To post pieces of code, surround them with <code>...</code> tags. For PHP code, you can use <?php ... ?>, which will also colour it based on syntax.
  • Adressen van webpagina's en e-mailadressen worden automatisch naar links omgezet.
  • Toegelaten HTML-tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <h4> <h5> <h2> <img>
  • Regels en alinea's worden automatisch gesplitst.
Bij het indienen van dit fomulier gaat u akkoord met het privacybeleid van Mollom.