The history of PHP is the history of the web. Long-time developers will remember how PHP changed the universe of web development. PHP brought two key innovations to the table when it first launched. First, it was interpreted, which meant you could edit a file in place, then refresh the page and see the result. This quick feedback loop was why so many started with PHP and is still a cornerstone of what makes the language so useful. Second, it was the first widespread templating language which enabled intermixing of HTML and PHP code. Every other major web language and framework since PHP has followed suit.
Over time, PHP became a cornerstone of the “LAMP stack”. The LAMP stack consisted of Linux, Apache, MySQL, and PHP, and helped to define the world of open source we all take for granted today. The ubiquity of open-source software in web development is near-absolute now, but it was the success of these technologies that redefined an industry.
Of course PHP wasn’t perfect and other languages and their frameworks came along to contend with PHP as the years went by. In fact, Heroku’s founders ran a PHP consultancy called Bitscribe which focused on PHP development before founding Heroku. They eventually moved from PHP on to Ruby on Rails, which led to the creation of Heroku when they discovered that the Rails ecosystem lacked good hosting options.
The best way to get someone to do the right thing is to make it the easiest thing to do. That’s why we’ve built Heroku to support and encourage the best practices of modern software development out of the box. We’ve captured a lot of this experience in the Twelve-Factor App Manifesto, and now we’ve also applied it to our new PHP support on the platform. Here’s a look at just of the few of they ways they apply:
The days of live on-server editing along with all the late nights and outages it inevitably leads to are fortunately behind us. Version control is ubiquitous today, and it’s rare to meet a development team not collaborating using a tool like Phabricator or GitHub. Unfortunately, it’s still far too common for system libraries, web servers, and extensions to be mismatched between dev, staging, and production environments. On Heroku, your git integrated deployment pipeline allows you to “git push” to deploy code with confidence whether it’s to your development environment or to production. We’ll use Composer to automatically ensure you get exactly the right version of all your code’s dependencies every time, including configuring either Apache or Nginx, and all your system dependencies.
Although many other languages have grown their own rudimentary native web servers, it’s still most common to pair PHP with a dedicated web server. Apache is the most common choice and very well understood, but Nginx is certainly growing in popularity. We support both, and in order to improve dev-prod parity, we’ve built a composer package that lets you, the developer, choose which one you prefer, receive a sensible configuration out-of-the-box, and further configure them with ease whether you’re running on Heroku, your local machine, or anywhere you please.
In today's world, PHP developers choose from a huge variety of technology options. These include modern data stores like PostgreSQL, Redis, and MongoDB, front-end frameworks like Angular, and platforms like, of course, Heroku.
In fact, for many modern PHP applications the notion of the LAMP stack seems limiting. Fortunately, PHP developers on Heroku can fearlessly take advantage of just about any technology they can imagine. For example, every PHP app on Heroku includes a free PostgreSQL database with support for a wide variety of powerful features like full-text search, and native JSON types. If Postgres isn’t to your liking our add-on marketplace brings the entire ecosystem to your fingertips. If you’ve got a technology need, you’ll probably find just the add-on you’re looking for.
One piece of future direction we’re incredibly excited about is Hack. Hack brings a whole host of new developments to PHP. Many PHP developers have heard about HHVM, Facebook’s high performance PHP virtual-machine project. Hack is another project from that team, and it includes great new features like an improved collections library, asynchronous method calls, and even the world’s friendliest type-system - all while supporting vanilla PHP code and enabling you to adopt it incrementally as you discover the features you need. And Hack is available for you to try directly on Heroku today with this new PHP support.
We should note though, Hack is quite new, and we encourage you to give it a try, but at this point support for Hack should definitely be considered
experimental and we would encourage you to test it thoroughly before putting anything into production.
When you put all these pieces together, it’s inarguable: PHP’s future is bright. Hundreds of thousands of PHP developers ship code every day. From Facebook to Etsy to Wordpress: big companies continue to invest in PHP. Between the long-term stewardship of Zend and the new creative energies Facebook’s
Hack language have brought to the community, it’s clear that no matter what flavor of PHP you choose there’s an ever more powerful, flexible future… with lots of fast feedback.
Whether you’re engineering high-scale mission-critical systems every day or you’re just making things for yourself and your friends, try the new PHP in public beta on Heroku today.
Happy making, and welcome to Heroku.