(How to) Install Processwire - lemachinarbo/ddev-dewire GitHub Wiki

Installing Processwire with DeWire is as simple as running:

ddev dw-install

But let me share some tips and guide you from zero, to see if I can convince you to use DeWire as your de facto way to kick off any Processwire project.

Installing from Zero

TL;DR

mkdir myproject
cd myproject
ddev config --auto
ddev add-on get lemachinarbo/ddev-dewired
ddev dw-install

Step by Step

[!important] This guide assumes you're using DDEV for local development. Aren’t you? It's time to convert.

DDEV setup

Hands on the keyboard! Open your terminal and start by creating a DDEV project:

mkdir myproject
cd myproject
ddev config --auto

By using --auto, we're just accepting the defaults, which makes the kick-off faster and sets up an almost ready-to-go DDEV container, where we can install the DeWire add-on. To install it, type:

ddev add-on get lemachinarbo/ddev-dewired

And that's all you need to make the DeWire commands available in your DDEV project.

Processwire Installation

Using a public folder

When installing ProcessWire, I like to follow the structure from MoritzLost's Composer Integration guide:

/                  # approot
β”œβ”€β”€ composer.json  # Composer config
β”œβ”€β”€ public         # docroot (contains ProcessWire)
β”‚   β”œβ”€β”€ index.php
β”‚   β”œβ”€β”€ site       
β”‚   β”œβ”€β”€ wire       
β”‚   └── ...
└── src            # Your source files...
└── node_modules   # Other dependencies...
└── vendor         # Composer dependencies

Which allow me to encapsulate all ProcessWire files in the public folder and leaves everything elseβ€”packages, src, build tools, vendor, node stuffβ€”outside. The only difference is that a default ProcessWire installation places everything in the project root:

/                  # root
β”œβ”€β”€ composer.json  
β”œβ”€β”€ index.php      # Processwire is installed in the root
β”œβ”€β”€ site       
β”œβ”€β”€ wire       
└── src
└── node_modules   
└── vendor         

Also, that small change makes our approot (where the DDEV project lives) and docroot (the public web folder)β€” different, which can be pretty handy when working with DDEV.

Installing Processwire

Type:

ddev dw-install

And that's it! You can test your installation by using ddev launch

Customizing your installation

TL;DR

  1. Processwire is installed using these default settings
  2. You can modify them by creating a .env in your approot. use this template as a guide.
  3. Once finished, proceed with the installation ddev dw-install
wget -O .env https://raw.githubusercontent.com/lemachinarbo/ddev-compwser/dev/compwser/templates/.env.example
# (edit .envfile)
ddev dw-install

Defining settings with a .env File

To install ProcessWire, DeWire uses PWInstaller, a variation of RockShell Bernhard's PW-install which allows you to skip the prompts and install ProcessWire using some default settings.

But probably you will like to kickoff using your defaults and not mine, and that is possible by placing your settings in a .env in the approot. So, let's download the .env template and edit it:

wget -O .env https://raw.githubusercontent.com/lemachinarbo/ddev-compwser/dev/compwser/templates/.env.example

These local defaults were pre-filled for convenience. You can tweak them, but most work out of the box.

Database

DB_HOST=db
DB_NAME=db
DB_USER=db
DB_PASS=db
DB_PORT=3306
DB_ENGINE=InnoDB
DB_CHARSET=utf8mb4

Unless you're doing something advanced, leave these as-is. They match the DDEV defaults.

Admin

ADMIN_NAME=processwire
USERNAME=ddevadmin
USERPASS=ddevadmin
[email protected]

Change these to customize login credentials. Tip: ADMIN_NAME sets the admin URL β†’ https://foo.ddev.site/processwire.

Timezone & Domains

TIMEZONE=UTC 
# HTTP_HOSTS=yourdomain.com,anotherdomain.com

Set TIMEZONE from this PHP list. Uncomment HTTP_HOSTS if your local dev uses custom ports or domains (mysite.com:8443).

Permissions

CHMOD_DIR=0755
CHMOD_FILE=0644

Leave these unless you know what you're doing. See: File Permissions Guide

Debug

DEBUG=true

Toggle ProcessWire debug mode.

Installer Settings

PW_VERSION=dev
SITE_PROFILE=site-blank
DB_TABLES_ACTION=remove
PW_ROOT=public
  • PW_VERSION: dev or master (we always install the last release)
  • SITE_PROFILE: site-blank or site-rockfrontend (I promise more profiles will be available later)

Once you finish tweaking your settings, you can install processwire using the same command and the installer will pick your settings:

ddev dw-install

[!TIP] I have a prefilled .env file in my ~/projects/env/ folder, so whenever I start a new project, I just copy it over.