PHPackages                             handpressed/wp-multitenancy-boilerplate - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. handpressed/wp-multitenancy-boilerplate

ActiveProject[Utility &amp; Helpers](/categories/utility)

handpressed/wp-multitenancy-boilerplate
=======================================

WordPress multitenancy boilerplate configured and managed with Composer and PHP dotenv.

419713PHP

Since Dec 15Pushed 1y ago4 watchersCompare

[ Source](https://github.com/handpressed/wp-multitenancy-boilerplate)[ Packagist](https://packagist.org/packages/handpressed/wp-multitenancy-boilerplate)[ RSS](/packages/handpressed-wp-multitenancy-boilerplate/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Multitenancy Boilerplate
==================================

[](#wordpress-multitenancy-boilerplate)

Use Composer to configure and manage a WordPress instance (including themes and plugins) that's shared with multiple sites.

- [WordPress Multitenancy Boilerplate](#wordpress-multitenancy-boilerplate)
    - [Features](#features)
    - [Requirements](#requirements)
    - [Prerequisites](#prerequisites)
    - [Installation](#installation)
    - [Configuration](#configuration)
        - [Themes](#themes)
        - [Plugins](#plugins)
        - [Constants](#constants)
    - [Directory Structure](#directory-structure)
    - [Adding Sites](#adding-sites)
        - [Configuration](#configuration-1)
    - [See Also](#see-also)
    - [Credit](#credit)

Features
--------

[](#features)

- Improved directory structure
- Dependency management with [Composer](https://getcomposer.org)
- Easy WordPress configuration with environment and constants files
- Environment variables with [PHP dotenv](https://github.com/vlucas/phpdotenv)
- Enhanced security (separated web root and secure passwords with [roots/wp-password-bcrypt](https://github.com/roots/wp-password-bcrypt))
- WordPress [multitenancy](https://en.wikipedia.org/wiki/Multitenancy) (a single instance of WordPress core, themes and plugins serving multiple sites)

Requirements
------------

[](#requirements)

- PHP 8.1+
- Composer

Prerequisites
-------------

[](#prerequisites)

[Install Composer](https://getcomposer.org/doc/00-intro.md):

```
$ curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
```

Installation
------------

[](#installation)

```
$ composer create-project handpressed/wp-multitenancy-boilerplate:dev-main {directory}

$ cd {directory}
```

Replace `{directory}` with the name of your new WordPress project, e.g. its domain name.

Composer will download WordPress, move it to `/var/opt/wp` and then symlink `/var/opt/wp` to `web/wp` (see [Directory Structure](#directory-structure)).

Composer will also symlink `/var/opt/wp/wp-content/themes` to `web/app/themes`, `/var/opt/wp/wp-content/plugins` to `web/app/plugins` and `/var/opt/wp/wp-content/mu-plugins` to `web/app/mu-plugins`.

Sites can now share this single instance of WordPress.

Configuration
-------------

[](#configuration)

Open the `conf/.env` file and add your new site's home URL (`WP_HOME`) and database credentials (`DB_NAME`, `DB_USER`, `DB_PASSWORD`). You can also define the database `$table_prefix` (default is `wp_`) if required.

Set your site's vhost document root to `/path/to/{directory}/web`.

### Themes

[](#themes)

Add themes in `web/app/themes` as you would for a normal WordPress install.

### Plugins

[](#plugins)

[WordPress Packagist](https://wpackagist.org) is already registered in the `composer.json` file so any plugins from the [WordPress Plugin Directory](https://wordpress.org/plugins/) can easily be required.

To add a plugin, use `composer require /` from the command-line. If it's from WordPress Packagist then the namespace is always `wpackagist-plugin`, e.g.:

```
$ composer require wpackagist-plugin/wp-optimize
```

Whenever you add a new plugin or update WordPress core, run `composer update` to install your new packages.

Themes and plugins are installed in the symlinked `themes` and `plugins` directories in `/var/opt/wp/wp-content` and will be available to all multitenancy sites.

Note: Some plugins may make modifications to the core `wp-config.php` file. Any modifications to `wp-config.php` that are needed by an individual site should be moved to the site's `conf/wp-constants.php` file.

### Constants

[](#constants)

Put custom core, theme and plugin constants in `conf/wp-constants.php`.

Directory Structure
-------------------

[](#directory-structure)

```
├── composer.json             → Manage versions of WordPress, plugins and dependencies
├── conf                      → WordPress configuration files
│   ├── .env       	      → WordPress environment variables (WP_HOME, DB_NAME, DB_USER, DB_PASSWORD required)
│   ├── wp-constants.php      → Custom core, theme and plugin constants
│   ├── wp-env-config.php     → Primary WordPress config file (wp-config.php equivalent)
│   └── wp-salts.php          → Authentication unique keys and salts (auto generated)
├── vendor                    → Composer packages (never edit)
└── web                       → Web root (vhost document root)
    ├── app                   → wp-content equivalent
    │   ├── mu-plugins        ↔ Must-use plugins symlinked to /var/opt/wp/wp-content/mu-plugins
    │   ├── plugins           ↔ Plugins symlinked to /var/opt/wp/wp-content/plugins
    │   ├── themes            ↔ Themes symlinked to /var/opt/wp/wp-content/themes
    │   └── uploads           → Uploads
    ├── index.php             → Loads the WordPress environment and template (never edit)
    └── wp                    ↔ WordPress core symlinked to /var/opt/wp (never edit)
    	└── wp-config.php     → Required by WordPress - loads conf/wp-env-config.php (never edit)

```

`↔` denotes a symlink.

Adding Sites
------------

[](#adding-sites)

Use [WP Multitenancy Add Site](https://github.com/handpressed/wp-multitenancy-add-site).

```
$ composer create-project handpressed/wp-multitenancy-add-site {new_directory}

$ cd {new_directory}
```

Replace `{new_directory}` with the name of your new project, e.g. its domain name.

### Configuration

[](#configuration-1)

Open the `conf/.env` file and add the new site's home URL (`WP_HOME`) and database credentials (`DB_NAME`, `DB_USER`, `DB_PASSWORD`). You can also define the database `$table_prefix` (default is `wp_`) if required.

Set the new site's vhost document root to `/path/to/{new_directory}/web`.

Added sites will use the existing WordPress instance (including themes and plugins) in `var/opt/wp`.

See Also
--------

[](#see-also)

[WordPress Substratum](https://github.com/handpressed/substratum)

Credit
------

[](#credit)

Based on [handpressed/substratum](https://github.com/handpressed/substratum). Inspired by [roots/bedrock](https://github.com/roots/bedrock) and [wpscholar/wp-skeleton](https://github.com/wpscholar/wp-skeleton).

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/98a491a6d588ba5e53fa7aa4cb27671e5dfd0d49c54c09183482db18e314c684?d=identicon)[handpressed](/maintainers/handpressed)

---

Top Contributors

[![handpressed](https://avatars.githubusercontent.com/u/36017877?v=4)](https://github.com/handpressed "handpressed (11 commits)")

---

Tags

composermultitenancyphpdotenvwordpress

### Embed Badge

![Health badge](/badges/handpressed-wp-multitenancy-boilerplate/health.svg)

```
[![Health](https://phpackages.com/badges/handpressed-wp-multitenancy-boilerplate/health.svg)](https://phpackages.com/packages/handpressed-wp-multitenancy-boilerplate)
```

###  Alternatives

[razonyang/yii2-rate-limiter

Yii2 Rate Limiter

1025.0k1](/packages/razonyang-yii2-rate-limiter)

PHPackages © 2026

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