studiometa / foehn-installer
Composer plugin that generates the WordPress web root, symlinks, and wp-config.php for Foehn projects.
Package info
github.com/studiometa/foehn-installer
Type:composer-plugin
pkg:composer/studiometa/foehn-installer
Requires
- php: ^8.5
- composer-plugin-api: ^2.0
Requires (Dev)
- composer/composer: ^2.10
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Composer plugin that generates the WordPress web root for Føhn projects.
Note This package is part of the Føhn Framework monorepo. Please report issues and submit pull requests in the main repository.
What it does
On composer install and composer update, this plugin automatically:
- Creates the
web/directory structure (document root) - Generates
web/wp-config.php(loads config fromconfig/directory) - Generates
web/index.php(WordPress front controller) - Symlinks
theme/→web/wp-content/themes/{name} - Symlinks
mu-plugins/→web/wp-content/mu-plugins/_custom - Generates the mu-plugin loader
- Generates the page cache drop-in and the maintenance page drop-in
- Copies the content of
public/intoweb/
Installation
composer require studiometa/foehn-installer
Configuration
Configure via extra.foehn in your project's composer.json:
{
"extra": {
"foehn": {
"web-dir": "web",
"wp-dir": "wp",
"theme-dir": "theme",
"theme-name": "my-theme",
"mu-plugins-dir": "mu-plugins",
"config-dir": "config",
"public-dir": "public"
}
}
}
All options are optional and have sensible defaults.
| Option | Default | Description |
|---|---|---|
web-dir |
web |
Web root directory (document root) |
wp-dir |
wp |
WordPress core directory within web root |
theme-dir |
theme |
Theme source directory to symlink |
theme-name |
theme |
Theme directory name in wp-content/themes/ |
mu-plugins-dir |
mu-plugins |
Custom mu-plugins directory to symlink |
config-dir |
config |
Configuration files directory |
public-dir |
public |
Directory copied into the web root |
Generated structure
web/ ← Document root (nginx/apache)
├── index.php ← Generated front controller
├── robots.txt ← Copied from public/
├── wp-config.php ← Generated configuration
├── wp/ ← WordPress core (via composer)
└── wp-content/
├── themes/
│ └── my-theme → ../../theme/
├── plugins/ ← Composer-managed plugins
├── mu-plugins/
│ ├── 00-loader.php ← Generated loader
│ └── _custom → ../../mu-plugins/
├── advanced-cache.php ← Generated page cache drop-in
├── maintenance.php ← Generated maintenance page drop-in
└── uploads/
Maintenance page
While .maintenance exists (wp maintenance-mode activate, or a core, plugin or theme update), WordPress loads wp-content/maintenance.php and stops, before the theme, the plugins and the database. The generated drop-in sends a 503 with Retry-After: 600, then prints theme/maintenance.php when the theme has one, and a plain page when it does not.
theme/maintenance.php is a plain PHP or HTML file. WordPress functions, Twig and the database are not available. Link the styles with a path, or put them inline:
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
<title>Maintenance</title>
</head>
<body>
<h1>Site en maintenance</h1>
<p>Revenez dans quelques minutes.</p>
</body>
</html>
Public files
The installer copies the content of public-dir into the web root, dotfiles included. It copies the files and does not create symlinks. index.php, wp-config.php, the WordPress directory and wp-content/ belong to the installer: it does not copy a public file to these paths, and shows a warning. A file removed from public-dir is removed from the web root on the next install. See Public Files.
License
MIT