PHPackages                             threespot/example-wordpress-composer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. threespot/example-wordpress-composer

ActiveProject[DevOps &amp; Deployment](/categories/devops)

threespot/example-wordpress-composer
====================================

Terminus build tools template for a Pantheon Composer WordPress application

2.4.5(2y ago)0147[12 issues](https://github.com/Threespot/example-wordpress-composer/issues)[5 PRs](https://github.com/Threespot/example-wordpress-composer/pulls)PHPPHP &gt;=7.3

Since Nov 29Pushed 5d ago1 watchersCompare

[ Source](https://github.com/Threespot/example-wordpress-composer)[ Packagist](https://packagist.org/packages/threespot/example-wordpress-composer)[ RSS](/packages/threespot-example-wordpress-composer/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (15)Versions (22)Used By (0)

Example WordPress Composer
==========================

[](#example-wordpress-composer)

[![CircleCI](https://camo.githubusercontent.com/ef5ddc2cbaa7bc0432fe910055c1418865688598e5c83f63375229e3c0d9dcde/68747470733a2f2f636972636c6563692e636f6d2f67682f70616e7468656f6e2d73797374656d732f6578616d706c652d776f726470726573732d636f6d706f7365722e7376673f7374796c653d737667)](https://circleci.com/gh/pantheon-systems/example-wordpress-composer)[![Actively Maintained](https://camo.githubusercontent.com/2ae5ff81f271fb028d720adee6b3595770166f3707a4705a4a2a3b71c332b249/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50616e7468656f6e2d4163746976656c795f4d61696e7461696e65642d79656c6c6f773f6c6f676f3d70616e7468656f6e26636f6c6f723d464644433238)](https://pantheon.io/docs/oss-support-levels#actively-maintained-support)

This repository is a reference implementation and start state for a modern WordPress workflow utilizing [Composer](https://getcomposer.org/), 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](https://github.com/pantheon-systems/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](https://github.com/pantheon-systems/terminus-build-tools-plugin/).

Important files and directories
-------------------------------

[](#important-files-and-directories)

### `/web`

[](#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`](https://pantheon.io/docs/pantheon-yml/#nested-docroot) documentation for details.

### `/web/wp`

[](#webwp)

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](https://codex.wordpress.org/Giving_WordPress_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](https://github.com/roots/bedrock).

### `composer.json`

[](#composerjson)

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 necessary 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](https://github.com/pantheon-systems/wordpress-composer/) 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`](https://getcomposer.org/doc/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md#how-do-i-install-a-package-to-a-custom-path-for-my-framework-) are used to ensure the WordPress dependencies are downloaded into the appropriate directory.

Non-WordPress dependencies are downloaded to the `/vendor` directory.

### `.ci`

[](#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`

[](#build-scripts-cibuild)

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`

[](#build-scripts-cideploy)

Scripts for facilitating code deployment to Pantheon.

- `.ci/deploy/pantheon/create-multidev` creates a new [Pantheon multidev environment](https://pantheon.io/docs/multidev/) for branches other than the default Git branch
    - Note that not all users have multidev access. Please consult [the multidev FAQ doc](https://pantheon.io/docs/multidev-faq/) for details.
- `.ci/deploy/pantheon/dev-multidev` deploys the built artifact to either the Pantheon `dev` or a multidev environment, depending on the Git branch

#### Automated Test Scripts `.ci/tests`

[](#automated-test-scripts-citests)

Scripts that run automated tests. Feel free to add or remove scripts here depending on your testing needs.

#### Github Actions Workflows `.ci/.github`

[](#github-actions-workflows-cigithub)

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 [PHPStan](https://phpstan.org/) static analysis (via [`szepeviktor/phpstan-wordpress`](https://github.com/szepeviktor/phpstan-wordpress)) and [PHP syntax checking](https://www.php.net/manual/en/function.php-check-syntax.php). See [Static Analysis](#static-analysis-phpstan) below for usage.
- `tests/unit/bootstrap.php` Bootstraps the Composer autoloader
- `tests/unit/TestAssert.php` An example Unit test. Project specific test files will need to be created in `tests/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](https://github.com/garris/BackstopJS) visual regression testing.
- `.ci/test/visual-regression/backstopConfig.js` The [BackstopJS](https://github.com/garris/BackstopJS) configuration file. Setting here will need to be updated for your project. For example, the `pathsToTest` variable determines the URLs to test.

Github Actions
--------------

[](#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

Static Analysis (PHPStan)
-------------------------

[](#static-analysis-phpstan)

This project uses [PHPStan](https://phpstan.org/) with the [`szepeviktor/phpstan-wordpress`](https://github.com/szepeviktor/phpstan-wordpress) extension and [`php-stubs/acf-pro-stubs`](https://github.com/php-stubs/acf-pro-stubs) to catch type-related bugs (null dereferences, wrong argument types, hook callback signature mismatches, missing array keys, etc.) without running the code.

Configuration lives in `phpstan.neon.dist`. Existing findings are deferred via `phpstan-baseline.neon` so new code is held to the level-5 bar without blocking on legacy issues.

PHPStan runs in CI on every push via the `static_tests` job in `.circleci/config.yml`, and `deploy_to_pantheon` is gated on it — failures block deploys.

### Running locally

[](#running-locally)

PHPStan needs the Sage theme's composer dependencies installed so it can resolve Acorn (`Roots\Acorn\*`) and Laravel (`Illuminate\*`) types.

```
# One-time: install root dev dependencies
composer install --ignore-platform-req=ext-redis

# One-time (and after pulling theme dep changes): install Sage's deps
(cd web/wp-content/themes/sage && composer install --ignore-platform-req=ext-redis)

# Run the analyzer
composer phpstan
```

### What's analyzed

[](#whats-analyzed)

- `web/wp-content/mu-plugins/loader.php`
- `web/wp-content/themes/sage/{app,config,functions.php,index.php}`

WordPress core, third-party plugins, the bundled `twentytwentyfive` theme, and Blade view files (`resources/views/`) are excluded. To analyze additional custom code (e.g. a new mu-plugin), add its path under `parameters.paths:` in `phpstan.neon.dist`.

### Updating the baseline

[](#updating-the-baseline)

When introducing legitimate findings you want to defer rather than fix immediately, regenerate the baseline:

```
./vendor/bin/phpstan analyse --memory-limit=1G --generate-baseline
```

Commit the updated `phpstan-baseline.neon`. Aim to shrink it over time, not grow it.

### Adjusting strictness

[](#adjusting-strictness)

Level is set in `phpstan.neon.dist` (currently `5`, on a 0–9 scale). Raise it once the baseline is empty.

Working locally with Lando
--------------------------

[](#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](https://docs.devwithlando.io/).

- [Install Lando](https://docs.devwithlando.io/installation/system-requirements.html), 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](https://docs.lando.dev/config/wordpress.html#configuration).
- Run `lando start` to start Lando.
    - Save the local site URL. It should be similar to `https://.lndo.site`.
- 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
----------------------

[](#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`.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance65

Regular maintenance activity

Popularity12

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~208 days

Recently: every ~230 days

Total

12

Last Release

797d ago

Major Versions

1.0.1 → 2.0.02019-06-27

PHP version history (2 changes)2.0.0PHP &gt;=7.2

2.4.1PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/0526d77f332981f2d9ef915617dbeaa4685f7fda1282ed6629e509124e167ce4?d=identicon)[br8dy](/maintainers/br8dy)

---

Top Contributors

[![ataylorme](https://avatars.githubusercontent.com/u/2133004?v=4)](https://github.com/ataylorme "ataylorme (31 commits)")[![matbrady](https://avatars.githubusercontent.com/u/1770862?v=4)](https://github.com/matbrady "matbrady (19 commits)")[![greg-1-anderson](https://avatars.githubusercontent.com/u/612191?v=4)](https://github.com/greg-1-anderson "greg-1-anderson (15 commits)")[![stevector](https://avatars.githubusercontent.com/u/211029?v=4)](https://github.com/stevector "stevector (15 commits)")[![tedw](https://avatars.githubusercontent.com/u/864716?v=4)](https://github.com/tedw "tedw (13 commits)")[![kporras07](https://avatars.githubusercontent.com/u/2217820?v=4)](https://github.com/kporras07 "kporras07 (10 commits)")[![pantheon-ci-bot](https://avatars.githubusercontent.com/u/26102846?v=4)](https://github.com/pantheon-ci-bot "pantheon-ci-bot (9 commits)")[![chrisheuberger](https://avatars.githubusercontent.com/u/7212504?v=4)](https://github.com/chrisheuberger "chrisheuberger (4 commits)")[![nelsonamaya82](https://avatars.githubusercontent.com/u/6953921?v=4)](https://github.com/nelsonamaya82 "nelsonamaya82 (2 commits)")[![carl-alberto](https://avatars.githubusercontent.com/u/5098765?v=4)](https://github.com/carl-alberto "carl-alberto (2 commits)")[![rvtraveller](https://avatars.githubusercontent.com/u/1789427?v=4)](https://github.com/rvtraveller "rvtraveller (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![thejimbirch](https://avatars.githubusercontent.com/u/5177009?v=4)](https://github.com/thejimbirch "thejimbirch (1 commits)")[![dankohn](https://avatars.githubusercontent.com/u/3083270?v=4)](https://github.com/dankohn "dankohn (1 commits)")[![danielboggs](https://avatars.githubusercontent.com/u/553698?v=4)](https://github.com/danielboggs "danielboggs (1 commits)")[![danielbachhuber](https://avatars.githubusercontent.com/u/36432?v=4)](https://github.com/danielbachhuber "danielbachhuber (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/threespot-example-wordpress-composer/health.svg)

```
[![Health](https://phpackages.com/badges/threespot-example-wordpress-composer/health.svg)](https://phpackages.com/packages/threespot-example-wordpress-composer)
```

###  Alternatives

[pantheon-systems/example-wordpress-composer

994.2k](/packages/pantheon-systems-example-wordpress-composer)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
