platformsh-templates / wordpress-composer

Wordpress (Composer)
14 stars 10 forks source link

WordPress (Composer) for Platform.sh

Deploy on Platform.sh

This template builds WordPress on Platform.sh using the johnbloch/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.

WordPress is a blogging and lightweight CMS written in PHP.

Features

Post-install

  1. Run through the WordPress installer as normal. You will not be asked for database credentials as those are already provided.

  2. This example looks for an optional wp-config-local.php in the project root that you can use to develop locally. This file is ignored in Git.

Example wp-config-local.php:

<?php

define('WP_HOME', "http://localhost");
define('WP_SITEURL',"http://localhost");
define('DB_NAME', "my_wordpress");
define('DB_USER', "user");
define('DB_PASSWORD', "a strong password");
define('DB_HOST', "127.0.0.1");
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

// These will be set automatically on Platform.sh to a different value, but that won't cause issues.
define('AUTH_KEY', 'SECURE_AUTH_KEY');
define('LOGGED_IN_KEY', 'LOGGED_IN_SALT');
define('NONCE_KEY', 'NONCE_SALT');
define('AUTH_SALT', 'SECURE_AUTH_SALT');

Customizations

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.

Local development

This template has been configured for use with Lando. Lando is Platform.sh's recommended local development tool. It is capable of reading your Platform.sh configuration files and standing up an environment that is very similar to your Platform.sh project. Additionally, Lando can easily pull down databases and file mounts from your Platform.sh project.

To get started using Lando with your Platform.sh project check out the Quick Start or the official Lando Platform.sh documentation.

References