Back to all posts

Introducing WP Setup

Introduction

Developing WordPress plugins and themes often requires a reliable development environment. Current we have good solutions as [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) from Autommatic, [Local WP](https://localwp.com/) from WP Engine, [Docker](https://www.docker.com/), [XAMPP](https://www.apachefriends.org/) (for old ones) and so on. All this can be good suits for a development environment, specially Local WP that is probably the easiest one to get up and running and wp-env that leverages Docker as a development environment in a very easy way to use.

After use most of existing options and find some barriers in specific cases, I decided to create my own solution, leveraging Docker as wp-env but allowing more flexibility and customization for advanced use cases.

Why a new tool?

Until some months ago I was using Local WP as my go-to solution in most of my projects and in a specific and more advanced one, Docker with Docker Compose to create a custom environment. Recently I started to use wp-env and I was very impressed with the simplicity and power of this tool, also to easily configure a test environment with PHPUnit by default, but again, in a specific use case I found a limitation that makes me get back to Docker and Docker Compose and lost some time to configure my environment as I need.

In this last and specific case I was working with a Laravel application that needs to interact with a WordPress site, and as both works from different Compose projects, I need to add a custom configuration to allow internal requests between them, what get easy to do with Laravel Sail, simply adding a `extra_hosts` configuration to the `docker-compose.yml` file but was impossible to do with wp-env and probably will not be implemented as we can see from [this Github issue](https://github.com/WordPress/gutenberg/issues/25486).

So, I decided to create my own solution, leveraging a similar approach to wp-env but allowing more flexibility and customization, also removing some custom scripts that I need to further customize my environment (as configuring WordPRess Multisite).

Meet WP Setup

[WP Setup](https://www.npmjs.com/package/wp-setup) is a simple and powerful tool to create a WordPress development environment using Docker and Docker Compose, providing a simple CLI tool that allows you to create a new WordPress project in a few seconds.

Currently it should be used as a node development dependency and can be easily installed using npm, pnpm or yarn.

Features

Currently these are the main available features of WP Setup:

  • Create a new WordPress environment in a few seconds
  • Customize your environment using a simple configuration file or CLI options
  • Allow inject custom Docker Compose file to override the default one, allowing you to customize your environment as you need (add custom services, volumes, networks, etc)
  • Easily configure WordPress Multisite with subdomains or subdirectories
  • Uses the new FrankenPHP server to add SSL support to your local environment

Under development

The Test environment with PHPUnit and Pest is ready and you can see [here](https://dev.to/lucascarvalhopl/wordpress-tests-with-pest-and-wp-setup-2cho) how to start using

This is a new tool and is under development. These way some features are not implemented yet, as:

  • Test environment with PHPUnit
  • Build environment to easily build your project for production
  • Xdebug support
  • Composer CLI to easily run composer commands in your WordPress project without the need to enter in the container or even have PHP installed in your machine
  • Sync Hosts to automatically add your development domain to your hosts file

My priority at this moment is to implement the test environment with PHPUnit and Xdebug support, as I need this in my daily work, but I'm open to suggestions and contributions.

Also I'm looking into the possibility to use [WordPress JS Hooks](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-hooks/) to allow further customization of the environment (aka adding environment plugins). This can be useful to standardize the creation and configuration of different services and tools in the environment, such as MailHog, Redis, etc.

Give it a try

I invite you to give WP Setup a try for your WordPress development projects. Whether you're a novice or an advanced user, WP Setup aims to simplify your workflow while offering the flexibility you need.

For detailed installation instructions and to start using WP Setup, visit [this link](https://www.npmjs.com/package/wp-setup). Your feedback and contributions will help to improve and expand the capabilities of WP Setup. Let's make WordPress development smoother and more efficient together!

LC

About the Author

Lucas Carvalho is a full-stack developer from Sao Paulo, Brazil, with 9+ years of experience focused on software architecture, web applications, APIs, integrations, and developer tooling.

Recent Posts

XDebug with WP Setup

WP Setup v1.1.0 introduces XDebug support for easy test coverage reports, CLI command debugging, and HTTP execution. Enhance your WordPress development now!

The PHP Orkestra Framework

Discover Orkestra, a lightweight, extensible PHP framework, designed to provide a flexible foundation for web development. Perfect for tailored, efficient projects.

WordPress tests with Pest and WP Setup

Set up a WordPress test environment using WP Setup with Pest. Follow our simple steps to create and test a basic plugin effortlessly. Happy coding!