pantheon-systems / example-wordpress-composer
Installs: 4 081
Dependents: 0
Suggesters: 0
Security: 0
Stars: 95
Watchers: 13
Forks: 51
Open Issues: 25
Type:project
Requires
- php: >=7.3
- composer/installers: ^1.3.0
- pantheon-systems/quicksilver-pushback: ^2
- pantheon-systems/wordpress-composer: *
- roots/wp-password-bcrypt: ^1.0.0
- vlucas/phpdotenv: ^3.1.0
- wpackagist-plugin/lh-hsts: ^1.24
- wpackagist-plugin/pantheon-advanced-page-cache: >=0.3.0
- wpackagist-plugin/wp-native-php-sessions: >=0.6.9
- wpackagist-theme/twentynineteen: ^1.2
Requires (Dev)
- brain/monkey: ^2.2.0
- dealerdirect/phpcodesniffer-composer-installer: ^0.7
- phpunit/phpunit: ^7.5.1
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.4.0
- wp-coding-standards/wpcs: ^1.2.1
- dev-master
- 2.4.5
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.0
- 1.0.1
- dev-add-catalog-workflow-20241010
- dev-rename-catalog-info-20240923
- dev-add-catalog-info-20240910
- dev-LOPS-2012
- dev-clu-2023-01-05-00-04
- dev-clu-2022-12-31-00-04
- dev-clu-2022-12-09-00-04
- dev-clu-2022-12-08-00-04
- dev-clu-2022-12-06-00-03
- dev-bugs-5332
- dev-clu-2022-12-03-00-04
- dev-clu-2022-12-01-00-03
- dev-clu-2022-10-26-00-03
- dev-clu-2022-10-25-00-04
- dev-clu-2022-10-20-00-03
- dev-clu-2022-10-13-00-03
- dev-clu-2022-10-07-00-04
- dev-clu-2022-09-24-00-03
- dev-clu-2022-09-22-00-04
- dev-clu-2022-08-29-00-03
- dev-CdrMarks-patch-1
- dev-clu-2022-08-07-00-03
- dev-clu-2022-07-22-00-03
- dev-clu-2022-07-09-00-02
- dev-clu-2022-07-08-00-02
- dev-clu-2022-07-01-00-02
- dev-clu-2022-06-30-00-03
- dev-clu-2022-06-26-00-03
- dev-clu-2022-06-23-00-02
- dev-clu-2022-06-19-00-03
- dev-clu-2022-06-12-00-02
- dev-clu-2022-06-11-00-02
- dev-clu-2022-06-04-00-02
- dev-clu-2022-06-03-00-02
- dev-clu-2022-05-13-00-02
- dev-clu-2022-05-12-00-02
- dev-clu-2022-05-02-00-02
- dev-clu-2022-05-01-00-02
- dev-fix-tests
- dev-clu-2022-04-24-00-02
- dev-clu-2022-04-23-00-03
- dev-clu-2022-04-15-00-02
- dev-clu-2022-04-13-00-03
- dev-clu-2022-04-03-00-03
- dev-clu-2022-03-18-00-03
- dev-clu-2022-03-04-00-02
- dev-clu-2022-02-26-00-03
- dev-clu-2022-02-14-00-02
- dev-clu-2022-02-06-00-02
- dev-clu-2022-02-05-00-03
- dev-clu-2022-01-26-00-02
- dev-clu-2022-01-15-00-03
- dev-clu-2021-12-16-00-03
- dev-mariadb-104
- dev-clu-2021-11-20-00-02
- dev-clu-2021-11-18-00-03
- dev-clu-2021-11-08-00-02
- dev-clu-2021-11-07-00-02
- dev-clu-2021-11-02-00-02
- dev-clu-2021-11-01-00-03
- dev-clu-2021-09-17-00-03
- dev-bump-wordpress-version-581
- dev-clu-2021-09-14-00-05
- dev-clu-2021-09-11-00-03
- dev-clu-2021-09-01-00-03
- dev-clu-2021-08-24-00-02
- dev-clu-2021-08-23-00-03
- dev-clu-2021-08-21-00-03
- dev-clu-2021-07-23-00-04
- dev-clu-2021-07-14-00-03
- dev-clu-2021-07-13-00-03
- dev-clu-2021-06-29-00-03
- dev-clu-2021-06-23-00-03
- dev-clu-2021-05-19-00-03
- dev-clu-2021-05-18-00-03
- dev-clu-2021-05-14-00-04
- dev-clu-2021-05-01-00-03
- dev-clu-2021-04-29-00-04
- dev-clu-2021-04-27-00-04
- dev-clu-2021-04-23-00-03
- dev-clu-2021-04-17-00-03
- dev-clu-2021-03-24-00-05
- dev-clu-2021-03-22-00-04
- dev-clu-2021-03-20-00-04
- dev-clu-2021-03-17-00-04
- dev-clu-2021-03-14-00-05
- dev-clu-2021-03-06-00-04
- dev-clu-2021-03-05-00-04
- dev-clu-2021-02-17-00-03
- dev-clu-2021-02-04-00-05
- dev-clu-2021-01-25-00-10
- dev-clu-2021-01-20-00-07
- dev-clu-2021-01-09-00-05
- dev-clu-2021-01-08-00-07
- dev-clu-2021-01-01-00-05
- dev-clu-2020-12-23-00-05
- dev-clu-2020-12-15-00-06
- dev-clu-2020-12-14-00-06
- dev-clu-2020-12-09-00-06
- dev-clu-2020-12-06-00-05
- dev-clu-2020-12-03-00-05
- dev-clu-2020-12-02-00-07
- dev-clu-2020-11-30-00-05
- dev-clu-2020-11-26-00-05
- dev-clu-2020-11-25-00-07
- dev-clu-2020-11-23-00-05
- dev-clu-2020-11-20-00-05
- dev-clu-2020-11-17-00-05
- dev-clu-2020-11-12-00-06
- dev-clu-2020-11-11-00-06
- dev-composer-2
- dev-clu-2020-10-31-00-06
- dev-clu-2020-10-30-00-06
- dev-clu-2020-10-26-00-05
- dev-clu-2020-10-24-00-04
- dev-clu-2020-10-16-00-05
- dev-clu-2020-10-08-00-04
- dev-clu-2020-10-05-00-04
- dev-clu-2020-09-30-00-06
- dev-clu-2020-09-25-00-05
- dev-clu-2020-09-24-00-04
- dev-clu-2020-08-30-00-04
- dev-clu-2020-08-29-00-04
- dev-main
- dev-clu-2019-11-13-01-53
- dev-clu-2019-10-17-00-04
- dev-clu-2019-10-14-22-25
- dev-clu-2019-08-09-16-39
- dev-clu-2019-08-04-00-04
- dev-clu-2019-06-06-00-02
- dev-clu-2019-05-25-00-02
- dev-clu-2019-05-24-00-02
- dev-wordsesh-2019-demo
- dev-clu-2019-05-23-00-02
- dev-clu-2019-05-22-00-02
- dev-clu-2019-05-21-00-02
- dev-clu-2019-05-20-00-02
- dev-clu-2019-05-19-00-02
- dev-clu-2019-05-18-00-02
- dev-clu-2019-05-17-00-02
- dev-clu-2019-05-16-00-02
- dev-clu-2019-05-15-00-02
- dev-clu-2019-05-14-00-03
- dev-clu-2019-05-13-00-02
- dev-clu-2019-05-12-00-06
- dev-clu-2019-05-11-00-02
- dev-clu-2019-05-10-00-02
- dev-clu-2019-05-09-00-02
- dev-clu-2019-05-08-00-28
- dev-clu-2019-05-08-00-02
- dev-clu-2019-05-07-00-04
- dev-clu-2019-05-06-00-02
- dev-clu-2019-05-05-00-02
- dev-clu-2019-05-04-00-02
- dev-clu-2019-05-03-00-02
- dev-clu-2019-05-02-00-02
- dev-clu-2019-05-01-00-02
- dev-clu-2019-04-30-00-02
- dev-clu-2019-04-29-00-02
- dev-clu-2019-04-28-00-03
- dev-clu-2019-04-27-00-02
- dev-clu-2019-04-26-00-02
- dev-clu-2019-04-25-00-03
- dev-clu-2019-04-24-00-02
- dev-clu-2019-04-23-00-02
- dev-wordpress-5.1.1
- dev-custom-login
- dev-update-5.1
- dev-gitlab-ci-no-pr
- dev-clu-2018-12-06-22-44
- dev-default-php72
- dev-clu-2017-10-31-18-11
- dev-readme-instructions
- dev-issue-35-quicksilver-pushback-403
- dev-behat-example-for-webinar
- dev-php-70--global-variables
- dev-php-70--pin-wordhat
- dev-php-70-plus-logic-fix
- dev-php56
- dev-dynamic-build-tools-version
- dev-packagist-test
- dev-coming-soon
- dev-old-master
This package is auto-updated.
Last update: 2024-10-11 01:23:49 UTC
README
This repository is a reference implementation and start state for a modern WordPress workflow utilizing Composer, Continuous Integration (CI), Automated Testing, and Pantheon. Even though this is a good starting point, you will need to customize and maintain the CI/testing set up for your projects.
This repository is meant to be copied one-time by the the Terminus Build Tools Plugin but can also be used as a template. It should not be cloned or forked directly.
The Terminus Build Tools plugin will scaffold a new project, including:
- A Git repository
- A free Pantheon sandbox site
- Continuous Integration configuration/credential set up
For more details and instructions on creating a new project, see the Terminus Build Tools Plugin.
Important files and directories
/web
Pantheon will serve the site from the /web
subdirectory due to the configuration in pantheon.yml
. This is necessary for a Composer based workflow. Having your website in this subdirectory also allows for tests, scripts, and other files related to your project to be stored in your repo without polluting your web document root or being web accessible from Pantheon. They may still be accessible from your version control project if it is public. See the pantheon.yml
documentation for details.
/web/wp
Even within the /web
directory you may notice that other directories and files are in different places compared to a default WordPress installation. WordPress allows installing WordPress core in its own directory, which is necessary when installing WordPress with Composer.
See /web/wp-config.php
for key settings, such as WP_SITEURL
, which must be updated so that WordPress core functions properly in the relocated /web/wp
directory. The overall layout of directories in the repo is inspired by, but doesn't exactly mirror, Bedrock.
composer.json
This project uses Composer to manage third-party PHP dependencies.
The require
section of composer.json
should be used for any dependencies your web project needs, even those that might only be used on non-Live environments. All dependencies in require
will be pushed to Pantheon.
The require-dev
section should be used for dependencies that are not a part of the web application but are necesarry to build or test the project. Some example are php_codesniffer
and phpunit
. Dev dependencies will not be deployed to Pantheon.
If you are just browsing this repository on GitHub, you may not see some of the directories mentioned above, such as web/wp
. That is because WordPress core and its plugins are installed via Composer and ignored in the .gitignore
file.
A custom, Composer version of WordPress for Pantheon is used as the source for WordPress core.
Third party WordPress dependencies, such as plugins and themes, are added to the project via composer.json
. The composer.lock
file keeps track of the exact version of dependency. Composer installer-paths
are used to ensure the WordPress dependencies are downloaded into the appropriate directory.
Non-WordPress dependencies are downloaded to the /vendor
directory.
.ci
This .ci
directory is where all of the scripts that run on Continuous Integration are stored. Provider specific configuration files, such as .circle/config.yml
and .gitlab-ci.yml
, make use of these scripts.
The scripts are organized into subdirectories of .ci
according to their function: build
, deploy
, or test
.
Build Scripts .ci/build
Steps for building an artifact suitable for deployment. Feel free to add other build scripts here, such as installing Node dependencies, depending on your needs.
.ci/build/php
installs PHP dependencies with Composer
Build Scripts .ci/deploy
Scripts for facilitating code deployment to Pantheon.
.ci/deploy/pantheon/create-multidev
creates a new Pantheon multidev environment for branches other than the default Git branch- Note that not all users have multidev access. Please consult the multidev FAQ doc for details.
.ci/deploy/pantheon/dev-multidev
deploys the built artifact to either the Pantheondev
or a multidev environment, depending on the Git branch
Automated Test Scripts .ci/tests
Scripts that run automated tests. Feel free to add or remove scripts here depending on your testing needs.
Github Actions Workflows .ci/.github
This folder should be copied to .github folder in root to enable Github Actions. Also, some secrets need to be added to Github Actions configuration.
Static Testing .ci/test/static
and tests/unit
Static tests analyze code without executing it. It is good at detecting syntax error but not functionality.
.ci/test/static/run
Runs PHP CodeSniffer with WordPress coding standards, PHP Unit, and PHP syntax checking.tests/unit/bootstrap.php
Bootstraps the Composer autoloadertests/unit/TestAssert.php
An example Unit test. Project specific test files will need to be created intests/unit
.
Visual Regression Testing .ci/test/visual-regression
Visual regression testing uses a headless browser to take screenshots of web pages and compare them for visual differences.
.ci/test/visual-regression/run
Runs BackstopJS visual regression testing..ci/test/visual-regression/backstopConfig.js
The BackstopJS configuration file. Setting here will need to be updated for your project. For example, thepathsToTest
variable determines the URLs to test.
Github Actions
If you need to enable Github Actions for an existing project, you should copy .ci/.github to .github and then add the following secrets to Github Actions configuration:
- ADMIN_EMAIL
- ADMIN_PASSWORD
- ADMIN_USERNAME
- TERMINUS_TOKEN
- TERMINUS_SITE
- SSH_PRIVATE_KEY
- GH_TOKEN
Working locally with Lando
To get started using Lando to develop locally complete these one-time steps. Please note than Lando is an independent product and is not supported by Pantheon. For further assistance please refer to the Lando documentation.
- Install Lando, if not already installed.
- Clone your project repository from GitHub (or GitLab or BitBucket) locally.
- Manually create a
.lando.yml
file with your preferred configuration, based on the WordPress recipe. - Run
lando start
to start Lando.- Save the local site URL. It should be similar to
https://<PROJECT_NAME>.lndo.site
.
- Save the local site URL. It should be similar to
- Run
lando composer install --no-ansi --no-interaction --optimize-autoloader --no-progress
to download dependencies - Run
lando pull --code=none
to download the media files and database from Pantheon. - Visit the local site URL saved from above.
You should now be able to edit your site locally. The steps above do not need to be completed on subsequent starts. You can stop Lando with lando stop
and start it again with lando start
.
Warning: do NOT push/pull code between Lando and Pantheon directly. All code should be pushed to GitHub and deployed to Pantheon through a continuous integration service, such as CircleCI.
Composer, Terminus and wp-cli commands should be run in Lando rather than on the host machine. This is done by prefixing the desired command with lando
. For example, after a change to composer.json
run lando composer update
rather than composer update
.
Re-enabling automation
The automation which ran daily to check for composer updates has been disabled as of 12/5/22
. Build Tools users can re-enable automation to check for composer updates by uncommenting uncommenting the scheduled_update_check
in .circleci/config.yml
.