Use Integrated Composer with WordPress
Learn how to use Integrated Composer with WordPress on Pantheon.
Integrated Composer is a Pantheon platform feature. Integrated Composer extends Composer functionality to WordPress core files and treats them as a managed dependency. Integrated Composer lets you deploy your site on Pantheon with one-click updates for both upstream commits and Composer dependencies, while still receiving upstream updates.
WordPress with Integrated Composer on Pantheon
Pantheon maintains a Composer-enabled WordPress Upstream repository. This is the recommended starting point for forking new upstreams that work with Pantheon's Integrated Composer build process.
This repository is still under active development, and you should not create permanent/production sites from it. There is no guarantee of backwards compatibility.
Pantheon upstreams influence the Composer packages that are included in downstream sites by including two composer.json
files in this repository:
The root
/composer.json
file is owned by the downstream site. Upstream maintainers should avoid editing this file. This allows the downstream site maintainer to adjust the/composer.json
file without creating potential conflicts when merging upstream updates.The
upstream-config/composer.json
file is owned by the upstream maintainer. It is included by the rootcomposer.json
file, and allows upstreams to add or remove packages from downstream sites. Changes are automatically incorporated into the downstream site whenever upstream updates are applied.
Create Your WordPress Integrated Composer Site
Follow the steps in this section to create a new WordPress site using Integrated Composer and Upstream.
Connect your repository to Pantheon.
Update the require section of the root
/composer.json
file to match the name you chose in the preceding step.
Add and Remove Packages
Use
composer require
in theupstream-config
directory to edit the upstreamcomposer.json
file.- The repository template places a theme in the upstream
composer.json
file. This works well for downstream sites that all use the same theme. You should remove themes from the upstreamcomposer.json
file if you do not intend to use the upstream to lock downstream sites into a particular theme. You cannot remove installed packages from downstream sites if the packages were included from the upstream site.
- The repository template places a theme in the upstream
Maintain Your Integrated Composer Fork
There are some special considerations to keep in mind if you intend to make modifications to your upstream based on this repository.
Increase the version number listed in the
upstream-config/composer.json
file each time you make edits.- Composer checks the contents of the root
/composer.json
file for changes that should be pushed to your upstream configuration.
- Composer checks the contents of the root
Verify your changes to the
upstream-config/composer.json
file by runningcomposer install
orcomposer update
in theupstream-config
directory.- Be careful not to rely on "root-only" properties of composer.json.
Manage Your WordPress Integrated Composer Site
Review the Integrated Composer Guide for information on how to:
Review the Custom Upstreams documentation to learn how to:
Review the Pantheon YAML Configuration Files documentation to learn about: