Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

# WordPress (Composer) for Platform.sh

This template builds WordPress on Platform.sh using the [`johnbloch/wordpress`](https://github.com/johnpbloch/wordpress) "Composer Fork" of WordPress. Plugins and themes should be managed with Composer exclusively. A custom configuration file is provided that runs on Platform.sh to automatically configure the database, so the installer will not ask you for database credentials. For local-only configuration you can use a `wp-config-local.php` file that gets excluded from Git.
This template builds WordPress on Platform.sh using [`roots/wordpress`](https://github.com/roots/wordpress), an actively-maintained meta-package for installing WordPress core via Composer. Plugins and themes should be managed with Composer exclusively. A custom configuration file is provided that runs on Platform.sh to automatically configure the database, so the installer will not ask you for database credentials. For local-only configuration you can use a `wp-config-local.php` file that gets excluded from Git.

WordPress is a blogging and lightweight CMS written in PHP.

## Features

* PHP 7.4
* PHP 8.1
* MariaDB 10.4
* Automatic TLS certificates
* Composer-based build
Expand Down Expand Up @@ -49,13 +49,13 @@ define('AUTH_SALT', 'SECURE_AUTH_SALT');

The following changes have been made relative to WordPress as it is downloaded from WordPress.org. If using this project as a reference for your own existing project, replicate the changes below to your project.

* It uses the [`johnbolch/wordpress`](https://github.com/johnpbloch/wordpress) "Composer Fork" of WordPress, which allow the site to be managed entirely with Composer.
* It uses [`roots/wordpress`](https://github.com/roots/wordpress) to install WordPress core via Composer, allowing the site to be managed entirely with Composer.
* The `.platform.app.yaml`, `.platform/services.yaml`, and `.platform/routes.yaml` files have been added. These provide Platform.sh-specific configuration and are present in all projects on Platform.sh. You may customize them as you see fit.
* An additional Composer library, [`platformsh/config-reader`](https://github.com/platformsh/config-reader-php), has been added. It provides convenience wrappers for accessing the Platform.sh environment variables.
* The `wp-config.php` file has been modified to use the Config Reader to configure WordPress based on Platform.sh environment variables if present. If not, your own `wp-config-local.php` file will be loaded to configure the site for local development.
* A base [Landofile](https://docs.lando.dev/config/lando.html#base-file) provides configuration to use this template locally using [Lando](https://docs.lando.dev).
* Any themes and plugins present in the most recent version of WordPress are detected and have been added as dependencies in `composer.json` so they are easier to update.
* The upstream `composer.json` file has been modified to include the script `subdirComposer`. It moves `wp-config.php` into the default install directory and docroot `wordpress` after `composer install` is run. It also removes a nested directory `wordpress/wp-content/wp-content`. Since WordPress is not by default intended to be installed via Composer, anything Composer-related wrapping around it does not always perfectly interact, and adding new themes and plugins via Composer is a case of this. If this command was not included, the initial deployment would work just fine, and the default themes and plugins would end up where you would expect in `wordpress/wp-content/[themes|plugins]`. However, once you `composer require` additional packages from WPackagist, those original default packages end up in a nested subdirectory `wordpress/wp-content/wp-content` and are inaccessible to WordPress. This is another reason that those default themes and plugins are added to `composer.json`, allowing us to remove this artifact when WordPress builds with Composer. You can view the original issue [here](https://github.com/platformsh-templates/wordpress-composer/issues/7).
* The upstream `composer.json` file has been modified to include the script `subdirComposer`. It moves `wp-config.php` into the default install directory and docroot `wordpress` after `composer install` is run. It also removes a nested directory `wordpress/wp-content/wp-content`. Since WordPress is not by default intended to be installed via Composer, anything Composer-related wrapping around it does not always perfectly interact, and adding new themes and plugins via Composer is a case of this. If this command was not included, the initial deployment would work just fine, and the default themes and plugins would end up where you would expect in `wordpress/wp-content/[themes|plugins]`. However, once you `composer require` additional packages from WP Packages, those original default packages end up in a nested subdirectory `wordpress/wp-content/wp-content` and are inaccessible to WordPress. This is another reason that those default themes and plugins are added to `composer.json`, allowing us to remove this artifact when WordPress builds with Composer. You can view the original issue [here](https://github.com/platformsh-templates/wordpress-composer/issues/7).


## Local development
Expand Down
40 changes: 15 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,38 @@
{
"name": "johnpbloch/wordpress",
"description": "WordPress is open source software you can use to create a beautiful website, blog, or app.",
"name": "platformsh-templates/wordpress-composer",
"description": "Platform.sh starter template for deploying WordPress via Composer.",
"keywords": [
"wordpress",
"blog",
"composer",
"platformsh",
"cms"
],
"type": "package",
"homepage": "https://wordpress.org/",
"type": "project",
"homepage": "https://github.com/platformsh-templates/wordpress-composer",
"license": "GPL-2.0+",
"authors": [
{
"name": "WordPress Community",
"homepage": "https://wordpress.org/about/"
}
],
"support": {
"issues": "https://core.trac.wordpress.org/",
"forum": "https://wordpress.org/support/",
"docs": "https://developer.wordpress.org/",
"irc": "irc://irc.freenode.net/wordpress",
"source": "https://core.trac.wordpress.org/browser"
"issues": "https://github.com/platformsh-templates/wordpress-composer/issues",
"source": "https://github.com/platformsh-templates/wordpress-composer"
},
"require": {
"php": ">=5.6.20",
"johnpbloch/wordpress-core-installer": "^1.0 || ^2.0",
"johnpbloch/wordpress-core": "^6.2.2",
"php": ">=8.0",
"roots/wordpress": "^6.0",
"platformsh/config-reader": "^2.4",
"wp-cli/wp-cli-bundle": "^2.7",
"psy/psysh": "^0.11.18",
"wpackagist-plugin/akismet": "^5.1",
"wpackagist-theme/twentytwentyone": "^2.0",
"wpackagist-theme/twentytwentytwo": "^2.0",
"wpackagist-theme/twentytwentythree": "^1.1"
"wp-plugin/akismet": "^5.1",
"wp-theme/twentytwentyfive": "^1.0"
},
"config": {
"allow-plugins": {
"johnpbloch/wordpress-core-installer": true,
"roots/wordpress-core-installer": true,
"composer/installers": true
}
},
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
"url": "https://repo.wp-packages.org"
}
],
"scripts": {
Expand All @@ -53,6 +42,7 @@
"post-install-cmd": "@subdirComposer"
},
"extra": {
"wordpress-install-dir": "wordpress",
"installer-paths": {
"wordpress/wp-content/plugins/{$name}": [
"type:wordpress-plugin"
Expand Down
Loading