An open API service indexing awesome lists of open source software.

https://github.com/feryardiant/wp-env

Zero-config, Docker-based local environment for rapid theme and plugin evaluation.
https://github.com/feryardiant/wp-env

wordpress wordpress-boilerplate wordpress-plugins wordpress-project wordpress-themes

Last synced: 27 days ago
JSON representation

Zero-config, Docker-based local environment for rapid theme and plugin evaluation.

Awesome Lists containing this project

README

          

# ๐Ÿ“ฆ WordPress Evaluation Environment

**Zero-config, Docker-based local environment for rapid theme and plugin evaluation.**

Spin up a fully installed WordPress site in seconds, bypassing the setup wizard entirely. This environment is pre-tuned for high-speed testing of themes, plugins, and complex setups like WooCommerce or Multisite.

### โšก Key Features
- ๐Ÿš€ **Zero-Config**: Fully installed WordPress site via `docker compose up`.
- ๐Ÿ›๏ธ **WooCommerce Ready**: Automatic store setup and configuration.
- ๐ŸŒ **Multisite Support**: One-click conversion to a subfolder network.
- ๐Ÿ“ง **Mailpit Integrated**: Instant email capture and testing dashboard.
- ๐Ÿ› ๏ธ **Monorepo Structure**: Manage multiple themes and plugins in one project.

## ๐Ÿš€ Quick Start

1. **Configure**: `cp .env.example .env`
2. **Start**: `docker compose up -d`
3. **Evaluate**: Visit [http://localhost:8080](http://localhost:8080)

> **Default Credentials:**
> **User:** `admin` | **Password:** `password`

## ๐Ÿ”‹ Built-in Evaluation Tools

### โšก Automated Installation
The environment uses a custom `init-wp.sh` engine to handle everything:
- Database creation and site installation.
- Admin user creation and plugin/theme activation.
- WooCommerce and Multisite configuration.
- **Plugin Cleanup**: Use `TRIM_PLUGINS` in `.env` to surgically remove default or unwanted plugins during setup.
- **Must-Use Plugins**: Support for `mu-plugins` via the `docker/mu-plugins` directory.
- **Bulk Installation**: Support for installing multiple plugins and themes via `scripts/init-plugins.txt` and `scripts/init-themes.txt`.

### ๐Ÿ›๏ธ WooCommerce Integration
If `woocommerce` is in `SITE_PLUGINS`, the store is automatically configured:
- Sets currency, units, and address via `.env`.
- Skips the onboarding wizard for a "Ready-to-Evaluate" experience.

### ๐ŸŒ Multisite-on-Demand
Convert your site to a **Multisite Network** by setting `MULTISITE_ENABLED=1`. The `cli` service handles the migration and `.htaccess` updates automatically.

### ๐Ÿ“ง Email Testing (Mailpit)
All outgoing emails are captured by **Mailpit**.
- **Dashboard:** [http://localhost:8025](http://localhost:8025)
- All local packages are automatically routed to the internal mail service.

## ๐Ÿ”Œ Evaluating Your Assets

### ๐Ÿ“ Local Packages
Place your theme or plugin folder in the [`packages/`](packages/) directory. They are automatically discovered and can be managed via the root toolset.

#### ๐Ÿ—๏ธ Adding a New Package
1. **Create Directory**: `mkdir packages/my-new-plugin`
2. **Mount Volume**: Update the `x-packages` anchor at the top of [`compose.yml`](compose.yml). This automatically syncs the volume across both `web` and `cli` services.
3. **Register PHP Dependencies**: Ensure the package has a `composer.json`. Run `composer install` at the project root to merge its dependencies.
4. **Register Assets**: Ensure the package has a `package.json`. Run `bun install` at the root to register its workspace.

### ๐ŸŒ Official Repository
Add slugs to `SITE_PLUGINS` or `SITE_THEMES` in your `.env`:
```bash
SITE_PLUGINS=akismet,woocommerce,contact-form-7
```

> **Note:** For bulk installation, you can also list slugs (one per line) in `scripts/init-plugins.txt` or `scripts/init-themes.txt`.

## ๐Ÿ—๏ธ Project Architecture

This project is organized as a **monorepo** and uses a modular Docker configuration to simplify the development of multiple WordPress assets simultaneously.

### ๐Ÿณ Docker Configuration
The environment uses a base configuration in `docker/compose.base.yml` which is extended by the root `compose.yml`. This separation allows for a clean, reusable base image and service definitions while keeping local development overrides isolated.

### ๐Ÿ“‚ Directory Structure
- [`assets/`](assets/): Static assets, favicon, and server configurations.
- [`docker/`](docker/): Local MySQL data and service configurations.
- [`packages/`](packages/): Local themes and plugins.
- [`scripts/`](scripts/): Development utilities (Installation, POT generation, Distribution).

## ๐Ÿ› ๏ธ Development Tools

### ๐Ÿ“ฆ Dependency Management
- **Bun**: Manages root tools and JS workspaces.
- **Composer**: Manages PHP dependencies with automated package merging.

### ๐ŸŽจ Linting & Formatting
- **Biome**: For JS, TS, JSON, and CSS (`bun lint`).
- **PHPCS**: All WordPress packages located in [`packages/`](packages/) directory should follow [WordPress](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/) Coding Standards (`composer lint:packages`), while the [`tests/`](tests/) should use [`PSR12`](https://www.php-fig.org/psr/psr-12/) Coding Standards (`composer lint:tests`).

### ๐Ÿ“ฆ Scripts
- [`scripts/init-wp.sh`](scripts/init-wp.sh): Dynamically download, configure, and install a fresh WordPress core.
- [`scripts/make-pot.sh`](scripts/make-pot.sh): Generates translation files for all packages.
- [`scripts/make-dist.sh`](scripts/make-dist.sh): Creates production-ready ZIP archives. Requires a `.distignore` file in the package directory to filter contents.

### ๐Ÿž Debugging & Inspections
- **Xdebug**: Pre-installed and configured for PHP 8.1+. Connect your IDE to the `9003` port on your local machine.
- **WP-CLI**: Access the containerized CLI via the `cli` service.
```bash
docker compose run --rm cli wp
```
- **Database Access**: Connect to the local MySQL server at `localhost:3306` using the credentials defined in `.env`.

## ๐Ÿงช Testing & Quality Assurance

This project includes a robust testing infrastructure for both unit and integration tests.

### ๐Ÿ› ๏ธ Testing Stack
- **PHPUnit 10.5**: The core testing framework.
- **Brain Monkey**: For advanced WordPress hook and function mocking.

### ๐Ÿš€ Running Tests Locally
Ensure you have installed development dependencies via `composer install`.
```bash
composer test
```
This will execute all test suites defined in [`phpunit.xml`](phpunit.xml) and output a text-based coverage report. Tests are designed to run on the host machine using the root `vendor/bin/phpunit` binary.

### ๐Ÿ”„ Continuous Integration (CI)
Automated testing is integrated into the development lifecycle via **GitHub Actions** ([`.github/workflows/main.yml`](.github/workflows/main.yml)):
- **Matrix Testing**: Every Pull Request and Push to `main` is automatically tested across multiple **PHP** and **WordPress** versions.

## โš™๏ธ Lifecycle & Configuration

### Lifecycle Commands
- **Start**: `docker compose up -d`
- **Stop**: `docker compose down`
- **Reset**: `docker compose down -v` (Wipes all data)
- **Logs**: `docker compose logs -f cli` (Monitor installation)

### Environment Variables
See [.env.example](.env.example) for a full list of available settings including site titles, admin credentials, and WooCommerce/Multisite options.

## โš–๏ธ Licensing

This project uses a **hybrid licensing model**:
- **Environment & Tools**: [MIT License](LICENSE-MIT).
- **WordPress Packages**: [GPLv3 or later](LICENSE-GPL).

This ensures the platform is free to use while ensuring all distributable assets remain compliant with the WordPress ecosystem.