Tagged with #TextPattern

Setup TextPattern using PHP composer and DDEV

I was totally going to step-by-step this guide but then I lost my draft.

TextPattern (TXP) instructs you to extract a zip file into your webroot and on upgrade replace all the files. If you have used PHP Composer to install your PHP dependencies you know this can be done more smoothly.

Composer PHP dependencies

If you want to the quick way, I've created a composer.json to get you started: view gist.

It adds the GitHub repository as a composer dependency, and installs it into the site/ directory using oomphinc/composer-installers-extender. The repo's type is set as a project type, so there are a couple of lines needed to setup composer installer to match it.

Run composer update, you will now have a site and vendor directory, in addition to the composer files:

├── composer.json
├── composer.lock
├── site
└── vendor

Missing JavaScript Depependencies

This typically should have been enough but in the TextPattern GitHub project the package.json file that contains the JavaScript dependencies is both ignored by git (so is missing from our checkout) but requires dependencies the install needs to run.

Let's pull in the copy from the main branch and install the dependencies using npm:

$ cd site
$ wget https://raw.githubusercontent.com/textpattern/textpattern/main/package.json
$ npm install --omit=dev
$ cd .. 

Local environment

For a local environment, I recommend DDEV. To set this up, simplify specify a project name and the docroot where the TXP install is installed to:

$ ddev config --docroot=site --project-name=mysite
$ ddev start
$ ddev launch

The #TextPattern Setup wizard should now open. Use ddev describe to inform you of the database values to enter in the setup wizard.

edit: For some reason I'm getting a database unavailable message. I'll update this if I find a solution. edit2: Solved I think, either through a reboot or the npm instructions.

September 11 at 2:57 pm