Drupal 8.1 has made a significant shift toward embracing Composer as the standard way to install and manage a Drupal site. Starting today, with Drupal 8.1.2, Platform.sh’s Drupal 8 templates are also Composer-based, and default to using PHP 7.
Absolutely nothing changes for sites already hosted with Platform.sh. If you’re using Drush Make or just checking your entire Drupal site into Git, you can continue to do so. Nothing in this post applies to you (unless you want it to).
When you create a new site with Platform.sh, you’re given the opportunity to select a “template” for a site. The template is really just a starter Git repository, complete with a recommended .platform.app.yaml file and .platform directory for a given application. Until now, the template for Drupal 7 and Drupal 8 used Drush Make as their build script. The Drupal 8 template now uses Composer, just like our Symfony template and most other PHP applications.
The Composer template is closely based on the (excellent) Drupal-Composer project built by the Drupal community. It adds only two patches to make Drupal install cleanly on a read-only file system, both of which have already gone through the Drupal issue queues and are just waiting to be committed. Once they’ve been incorporated into a point release we’ll drop those patches from our composer.json file.
As Drupal 8 is also fully tested with PHP 7, we’ve defaulted to PHP 7.0 for all newly created Drupal 8 sites.
As Platform.sh containers are always “production ready”, the composer command we use is optimized for production. Specifically, we run:
composer install --no-progress --prefer-dist --optimize-autoloader
Drupal currently has two different Composer services, a legacy one hosted at https://packagist.drupal-composer.org and a new, experimental one at https://packages.drupal.org/. We’ve been in contact with the Drupal.org Infrastructure team, and they’ve given us the go-ahead to default to the new, official service.
If you want to switch back to the legacy service, be sure to check the Drupal.org documentation page for notes on the different way it handles module versions.
Not to worry! If you need to start a new Drupal 8 site but want to run it on PHP 5.6 instead, simply edit your
.platform.app.yaml file and change the line
git push . Yes, it really is that easy.
(PHP versions before 5.6 are not supported by the PHP development team. We only provide those images to support legacy projects. Please use PHP 5.6 or, preferably, PHP 7 for all new projects. Security experts around the world thank you.)
Absolutely! Simply go to the template Git repository and copy the
.platform.app.yaml file and
.platform directory, then stick those in your project’s Git root. If you used the Drupal-Composer project to create it initially, all of the paths should still work fine. You will also need the
settings.platformsh.php files to ensure your site gets the correct database credentials and such. You can tweak the
.platform.app.yaml file if needed, such as if your files are organized differently.
You can also tweak those files as needed to configure your cluster exactly how you need. See the documentation for more details.
We’re still investigating whether we want to switch our Drupal 7 template over to Composer. (If you have thoughts on the matter, let us know.) Currently, Drupal 7’s test suite doesn’t fully pass under PHP 7 as there’s still a few edge case bugs, and a number of contrib modules need minor tweaks. We may default Drupal 7 to PHP 7 in the future when we feel it’s safe to do so. For now, we recommend PHP 5.6 for Drupal 7 sites.
Happy to help! See you in the Cloud…