Introduction
Developing WordPress plugins and themes often requires a reliable development environment. Current we have good solutions as wp-env from Autommatic, Local WP from WP Engine, Docker, XAMPP (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.
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 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
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 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. 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!
Discover more from Coursity
Subscribe to get the latest posts sent to your email.