DWS WP Framework
  • Welcome
  • Primary goals
    • Modular design
    • No 3rd-party dependencies
  • Key concepts and dev tools
    • PHP and WP requirements
    • Object-Oriented Programming
    • Semantic Versioning
    • Version Control (git / GitHub)
    • Dependency Management (Composer)
    • Automated Testing (Codeception + Github Actions)
    • Dependency Injection (PHP-DI)
    • Coding Standards (PHPCS and PHPMD)
    • Dependencies Scoping (PHP-Scoper)
    • TypeScript and Sass
    • Task Runners (Grunt)
  • Setting up your dev environment
    • Windows
  • Your first plugin
    • Multiple plugins using the framework on the same site
  • Frequently Asked Questions
  • Bootstrapper Module
    • Motivation
    • How it works
    • How to use
    • White Labeling
  • Helpers Module
    • Motivation
    • How to use
  • Foundations Module
    • Motivation and How to use
    • Actions
      • Local action traits
      • Extension action traits
      • Integration action traits
    • States
    • Utilities
      • Stores
      • Handlers and Services
        • Logging Service
  • Plugin
    • Main Plugin Instance
    • Plugin Components
  • Hierarchies
  • Helpers
  • Utilities Module
    • Motivation and How to use
    • Hooks Service
      • Scoped Handler
    • Shortcodes Service
    • Templating Service
    • Assets Service
      • Scripts Handler
      • Styles Handler
    • CRON Events Service
      • Action Scheduler Handler
    • Admin Notices Service
    • Dependencies Service
    • Validation Service
  • Core Module
    • Motivation and How to use
    • Plugin Tree
      • Plugin Root
      • Plugin Functionality
    • Plugin Components
      • Internationalization
      • Installation / Upgrade / Uninstallation
  • Settings Module
    • Motivation and How to use
    • Settings Service
      • WordPress Handler
      • MetaBox Handler
      • ACF Handler
    • Validated Settings
  • WooCommerce Module
    • Motivation and How to use
    • Extended WC Logger
    • WC Settings Handler
Powered by GitBook
On this page
  • Development folder
  • Linux Subsystem for Windows
  • Install DevKinsta
  • Install PHP7.4
  • Install Composer and Node.js
  • Install Git
  • Convenience stuff
  • You're done!

Was this helpful?

  1. Setting up your dev environment

Windows

PreviousSetting up your dev environmentNextYour first plugin

Last updated 3 years ago

Was this helpful?

This article will try to help you set up a development environment on your Windows machine. The assumption will be that you are trying to either contribute to the framework or build a plugin using it (and thus following all the standards laid out by the framework).

There is no guarantee that this will work. We can't account for software conflicts or misconfigurations present on your machine, but this should point you at least in the right direction.

Development folder

You're obviously free to organize your project files however you want, but we have a few suggestions that have worked well for us (since you're on Windows, especially). Namely, in your , create a new folder called Source. We also to this for easy recognition (place the icon file inside the folder):

Inside the Source folder, we usually create 3 new ones: Tools, Framework, and Plugins. Of course, your choice may vary based on what you want to do.

Linux Subsystem for Windows

Although we're running on Windows, the Linux Subsystem for Windows (WSL for short) is what we'll be using to install most software. If you are already familiar with the Linux command line, this should all feel pretty familiar.

Microsoft has a great article already explaining how to enable WSL and how to install your distribution of choice. In the spirit of not reinventing the wheel, just follow the steps . We recommend using WSL 2 and installing the distribution once you reach that step, but any distribution should do.

The article also mentions that you can optionally install to run PowerShell and WSL side-by-side. You don't have to, but we find it handy especially when using VVV for testing.

Install DevKinsta

For , you will need a running web server. For this task, we highly recommend although any tool like , or even plain old will do. If you move forward with VVV and followed our dev folder structure from above, VVV would belong into the Tools folder.

DevKinsta has a great guide on how to install it . Due to the virtualization nature of WSL2, your local environment is likely to be rather slow. Currently there is no known workaround and while it is annoying, it's usually fast enough for most purposes.

Unless explicitly mentioned otherwise, all the steps outlined below should be performed in your WSL terminal.

Install PHP7.4

Since we will not be using WSL as a server, you don't need to follow the instructions about setting up nginx or PHP-FPM. Vanilla PHP7.4 will do.

Install Composer and Node.js

Install Git

Convenience stuff

# go to the Source folder on startup
cd /mnt/c/Users/<YOUR WINDOWS USER NAME>/Source

# store the Windows host IP
export WINDOWS_HOST_IP=`cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2`

You're done!

Each module's tests folder contains an extra README.md file explaining how to set it all up to run tests on your local machine. WP-Browser also has some useful tutorials (albeit you need to selectively pick what applies) , , and .

While not strictly required to use 7.4, it is best to use a still supported version. If you followed our recommendation and installed Ubuntu, is an article explaining how to install PHP. If you installed a different distribution, at the bottom of the article you will find links to instructions for other systems.

As the PHP dependency manager, you will need to install Composer on your WSL. explaining how to install Composer on Ubuntu 20.04 together with links to other versions and distributions. The article show the installation of Composer 1.10, but you'll likely end up with Composer 2. That is fine and even recommended. If not, run composer self-update after the installation.

Optionally, you can go ahead and install Node.js and its companion dependency manager, npm. An article describing this procedure for Ubuntu 20.04 is . Node.js and npm are not strictly necessary for using the framework, but they do enable the use of and thus easy compilation of code and other automatable tasks. If you're doing that some other way already (or don't need/want that at all), feel free to skip this step.

For , we use git. Hence it is a good idea to install it on your WSL distribution. describing to how to that on Ubuntu 20.04.

However, the git command line is notoriously complicated. We strongly recommend you use a GUI instead, like (which is available for Windows, MacOS, and Linux -- in this case, you should download the Windows version for your main OS). It's a good idea to install git on WSL regardless though, just in case you'll need it at some point.

You can choose to edit your file to include the following commands:

Congratulations! Your dev environment is set up. It's time to open up your favorite IDE (we recommend ) and try out all your fancy new tools by setting up project!

for VVV
for WAMP
for Local by Flywheel
here
Here is an article
here
task runners
TypeScript and Sass
version control
Here is an article
GitKraken
.bashrc
PhpStorm
your first plugin
home directory
change its icon
from here
Ubuntu 20.04 LTS
Windows Terminal
automated testing
DevKinsta
Local by Flywheel
VVV
WAMP
right here
105KB
git-for-windows.ico
image
Source folder icon