wp-spaghetti/wp-boot

Wp-Boot is a lightweight Composer-based WordPress management system

Fund package maintenance!
buymeacoff.ee/frugan

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:project

pkg:composer/wp-spaghetti/wp-boot

v1.1.1 2025-12-21 22:52 UTC

This package is auto-updated.

Last update: 2025-12-21 22:52:25 UTC


README

PHP Version Packagist Downloads Packagist Stars GitHub Actions Workflow Status Coverage Status Known Vulnerabilities GitHub Issues

GitHub Release License

WP Boot

WP Boot is a lightweight Composer-based WordPress management system designed for scenarios where you need to manage an existing WordPress installation without restructuring its directory layout.

Requirements

  • PHP >= 8.1
  • Composer
  • rsync - Used to sync WordPress core files from vendor to public directory

Why WP Boot?

While robust solutions like Bedrock, WP Starter, and Wordplate offer excellent WordPress management through Composer, they typically require significant structural changes to the WordPress directory layout.

WP Boot was created for situations where:

  • You're working with an existing WordPress installation that cannot be heavily modified
  • You need to version control an already-deployed WordPress site
  • You want to dockerize a traditional WordPress setup without restructuring
  • You need a quick, minimal-impact solution for dependency management

How It Works

WP Boot uses rsync to synchronize WordPress core files from the Composer vendor directory to your public directory, keeping the standard WordPress structure intact.

It only modifies the wp-config.php file, adding a simple bootstrap block:

// BEGIN WP Boot - Do not remove this block
// @see https://github.com/wp-spaghetti/wp-boot
use function Env\env;

require_once dirname(__DIR__).'/private/wp-boot/bootstrap.php';
// END WP Boot - Do not remove this block

define('DB_NAME', env('DB_NAME'));
define('DB_USER', env('DB_USER'));
define('DB_PASSWORD', env('DB_PASSWORD'));
define('DB_HOST', env('DB_HOST'));

This approach allows you to:

  • Manage WordPress core, plugins, and themes via Composer
  • Use environment variables for configuration (.env files)
  • Keep the standard WordPress directory structure intact

Installation

composer create-project wp-spaghetti/wp-boot private/wp-boot
cd private/wp-boot
cp .env.dist .env
# Edit .env with your configuration
# IMPORTANT: Set WP_BOOT_SYNC_ENABLED=true to enable WordPress sync

Note: During composer create-project, WordPress core will be downloaded to vendor/wordpress/, but files will not be synced to your public/ directory until you set WP_BOOT_SYNC_ENABLED=true in your .env file.

This gives you time to:

  1. Review and configure your .env file
  2. Verify the target public/ directory exists and is correct
  3. Decide when to sync WordPress files

Once configured, run:

composer install  # or composer update

This will trigger the sync script and copy WordPress core files to ../../public/.

Then add the bootstrap block to your wp-config.php file (see "How It Works" section above).

Directory Structure

After installation, your project structure will look like this:

your-project/
├── private/
│   └── wp-boot/
│       ├── vendor/
│       │   └── wordpress/          # WordPress core managed by Composer
│       ├── .env                     # Environment configuration
│       ├── bootstrap.php
│       ├── composer.json
│       └── post-cmd.sh              # rsync sync script
└── public/                          # Your WordPress public directory
    ├── wp-admin/                    # Synced from vendor/wordpress
    ├── wp-includes/                 # Synced from vendor/wordpress
    ├── wp-content/
    │   ├── plugins/                 # Managed by Composer
    │   ├── themes/                  # Managed by Composer
    │   └── uploads/                 # User uploads (not managed)
    ├── wp-config.php                # Modified to include bootstrap
    └── index.php                    # Synced from vendor/wordpress

The post-cmd.sh script automatically syncs WordPress core files from private/wp-boot/vendor/wordpress/ to public/ after every composer install or composer update.

Optional: Installing Language Packs

WordPress core and plugins can be installed in different languages using Composer.

1. Add the language repository to composer.json:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://wp-languages.github.io",
      "only": [
        "koodimonni-language/*",
        "koodimonni-plugin-language/*",
        "koodimonni-theme-language/*"
      ]
    }
  ]
}

2. Add dropin paths to extra in composer.json:

{
  "extra": {
    "dropin-paths": {
      "../../public/wp-content/languages/": [
        "vendor:koodimonni-language"
      ],
      "../../public/wp-content/languages/plugins/": [
        "vendor:koodimonni-plugin-language"
      ],
      "../../public/wp-content/languages/themes/": [
        "vendor:koodimonni-theme-language"
      ]
    }
  }
}

3. Install language packs:

# WordPress core in Italian
composer require koodimonni-language/core-it_it

# All translations for Italian
composer require koodimonni-language/it_it

4. Configure WordPress to use the language in .env:

WPLANG=it_IT

For more information: https://wp-languages.github.io

Optional: Disallow Search Engine Indexing in Non-Production

WordPress 5.5+ includes native environment detection via WP_ENVIRONMENT_TYPE. Wp-boot automatically sets this based on your WP_ENV value in .env.

To prevent search engines from indexing staging/development sites, create this file:

public/wp-content/mu-plugins/disallow-indexing.php

<?php
/**
 * Plugin Name: Disallow Indexing (Non-Production)
 * Description: Automatically disallows search engine indexing in non-production environments
 */

if (wp_get_environment_type() !== 'production' && !is_admin()) {
    add_action('pre_option_blog_public', '__return_zero');
}

This automatically sets "Discourage search engines" in Settings → Reading for non-production environments.

When NOT to Use WP Boot

For new projects or when you have full control over the infrastructure, consider these more robust alternatives:

  • Bedrock - Modern WordPress stack with improved folder structure
  • WP Starter - Composer-based WordPress setup with flexible configuration
  • Wordplate - Modern WordPress stack with Laravel-inspired structure
  • WordPress Project - Minimal Composer-based WordPress installer

References

Changelog

Please see CHANGELOG for a detailed list of changes for each release.

We follow Semantic Versioning and use Conventional Commits to automatically generate our changelog.

Release Process

  • Major versions (1.0.0 → 2.0.0): Breaking changes
  • Minor versions (1.0.0 → 1.1.0): New features, backward compatible
  • Patch versions (1.0.0 → 1.0.1): Bug fixes, backward compatible

All releases are automatically created when changes are pushed to the main branch, based on commit message conventions.

Contributing

For your contributions please use:

See CONTRIBUTING for detailed guidelines.

Sponsor

Buy Me A Coffee

License

(ɔ) Copyleft 2025 Frugan.
GNU GPLv3, see LICENSE file.