Skip to content
On this page

Codegen Reference โ€‹

base โ€‹

Base installation utilities

Usage โ€‹

  • base <baseCommand> [<args>...]

๐Ÿ—๏ธ base โ€‹

You can use base to set up your base WordPress installation.

The available base commands are new, link, install, config, autoload, dotenv and setup.

Apart from new, these all need to be run from within your WordPress base installation directory.

You'll need to have โ™† wp-cli installed and available globally.

bash
forme base new project-name

This will setup a fresh WordPress installation in the project-name directory. Make sure you have your DB set up and creds ready before running this command.

bash
forme base link /path/to/your/plugin/or/theme/repo

This will create a symlink to your plugin or theme's repo from the current base installation.

bash
forme base install

Installs the latest version of WordPress into the public folder.

bash
forme base config

Initialises wp-config.php, including adding the FORME_PRIVATE_ROOT const, setting WP_ENV to development and punching in DB creds (you'll need those before running this)

bash
forme base autoload

Adds the autoload require statement into wp-config.php

bash
forme base dotenv

Copies .env.example to .env

bash
forme base setup

Runs all of the last four commands, i.e. install, config, autoload, and dotenv

Arguments โ€‹

baseCommand โ€‹

E.g. new, link, config, install, autoload, dotenv, setup

  • Is required: yes
  • Is array: no
  • Default: NULL

args โ€‹

Arguments to pass to the command

  • Is required: no
  • Is array: yes
  • Default: array ()

Options โ€‹

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

bump โ€‹

Bumps the version of a plugin or theme project

Usage โ€‹

  • bump [<scope>]

๐Ÿ‘Š bump โ€‹

You can use bump to increase plugin or theme version numbers according to โ™† semver principles.

This convenience command will bump your semver version tag, update the version number in your plugin's main file or theme style.css, render a new changelog (requires โ™† git cliff), commit and push for you all in one line.

Your version number should be in the format v0.0.0.

You can pass in the scope, i.e. major, minor or patch - defaults to patch.

# before e.g. v1.0.1
forme bump
# after v1.0.2

# before e.g. v1.0.2
forme bump minor
# after v1.1.0

# before e.g. v.1.10
forme bump major
# after v2.0.0

Arguments โ€‹

scope โ€‹

The scope of the bump - major, minor or patch

  • Is required: no
  • Is array: no
  • Default: 'patch'

Options โ€‹

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

completion โ€‹

Dump the shell completion script

Usage โ€‹

  • completion [--debug] [--] [<shell>]

The completion command dumps the shell completion script required to use shell autocompletion (currently, bash and fish completion is supported).

Static installation โ€‹

Dump the script to a global completion file and restart your shell:

forme completion bash | sudo tee /etc/bash_completion.d/forme

Or dump the script to a local file and source it:

forme completion bash > completion.sh

# source the file whenever you use the project
source completion.sh

# or add this line at the end of your "~/.bashrc" file:
source /path/to/completion.sh

Dynamic installation โ€‹

Add this to the end of your shell configuration file (e.g. "~/.bashrc"):

eval "$(forme completion bash)"

Arguments โ€‹

shell โ€‹

The shell type (e.g. "bash"), the value of the "$SHELL" env var will be used if this is not given

  • Is required: no
  • Is array: no
  • Default: NULL

Options โ€‹

--debug โ€‹

Tail the completion debug log

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

help โ€‹

Display help for a command

Usage โ€‹

  • help [--format FORMAT] [--raw] [--] [<command_name>]

The help command displays help for a given command:

forme help list

You can also output the help in other formats by using the --format option:

forme help --format=xml list

To display the list of available commands, please use the list command.

Arguments โ€‹

command_name โ€‹

The command name

  • Is required: no
  • Is array: no
  • Default: 'help'

Options โ€‹

--format โ€‹

The output format (txt, xml, json, or md)

  • Accept value: yes
  • Is value required: yes
  • Is multiple: no
  • Is negatable: no
  • Default: 'txt'

--raw โ€‹

To output raw command help

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

ketch โ€‹

A simple Docker cli for Forme

Usage โ€‹

  • ketch <ketchCommand> [<args>...]

โ›ต ketch โ€‹

You can use ketch to configure a new docker container, as well as to run basic docker-compose commands like up, down, restart, list etc.

You can also run a selection of commands within the configured container, such as composer, npm, npx and wp, or you can use shell to open a bash prompt in the container and run arbitrary commands.

You'll need docker and docker-compose installed as well as wp cli.

bash
forme ketch init

You'll need to run this from within an existing base installation. This will create all the relevant docker boilerplate for your project, and should also update your wp-config.php with the relevant db credentials and other settings.

# ๐Ÿ…๐Ÿ…๐Ÿ…
forme ketch up

This will spin up your app and mysql containers. You should be able to access your project from the browser at โ™† http://localhost and install WordPress.

bash
forme ketch down

This will stop and remove the running containers.

bash
forme ketch restart

This stops and starts the running containers.

bash
forme ketch link /path/to/your/plugin/or/theme/repo

Links plugin or theme repo directories into your container.

bash
forme ketch list

Lists running containers (equivalent to docker-compose ps)

forme ketch composer require foo/bar
forme ketch wp forme-queue
forme ketch npm install
forme ketch npx taze

You can run composer, wp, npm and npx commands within the container. NB: flags don't work.

bash
forme ketch shell

Full shell access within the container in case you need to run more complex commands.

Arguments โ€‹

ketchCommand โ€‹

E.g. init, up, down, restart, list, composer, npm, npx, wp, shell

  • Is required: yes
  • Is array: no
  • Default: NULL

args โ€‹

Arguments to pass to the command

  • Is required: no
  • Is array: yes
  • Default: array ()

Options โ€‹

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

list โ€‹

List commands

Usage โ€‹

  • list [--raw] [--format FORMAT] [--short] [--] [<namespace>]

The list command lists all commands:

forme list

You can also display the commands for a specific namespace:

forme list test

You can also output the information in other formats by using the --format option:

forme list --format=xml

It's also possible to get raw list of commands (useful for embedding command runner):

forme list --raw

Arguments โ€‹

namespace โ€‹

The namespace name

  • Is required: no
  • Is array: no
  • Default: NULL

Options โ€‹

--raw โ€‹

To output raw command list

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--format โ€‹

The output format (txt, xml, json, or md)

  • Accept value: yes
  • Is value required: yes
  • Is multiple: no
  • Is negatable: no
  • Default: 'txt'

--short โ€‹

To skip describing commands' arguments

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

make โ€‹

Generates class and other boilerplate in the current working directory

Usage โ€‹

  • make <type> <name>

๐Ÿงฐ make โ€‹

Generates class and other boilerplate in the current working directory.

You need to pass in the type of boilerplate you want to generate and a name.

Available types are action, filter, field, field-enum, controller, template-controller, registry, post-type, model, transformer, service, migration, job, middleware and command

For classes you should supply the name in PascalCase, for example:

bash
forme make controller FooBar

For hooks and post types, the name should be in snake_case.

bash
forme make action wp_loaded

Hooks and field enums will ask you for further configuration via an interactive cli.

Arguments โ€‹

type โ€‹

The type of class or hook - available types are action, filter, field, controller, template-controller, registry, post-type, model, transformer, service, migration, job, middleware, field-enum, command

  • Is required: yes
  • Is array: no
  • Default: NULL

name โ€‹

This could be the class prefix in PascalCase or the hook reference or custom post type in snake_case

  • Is required: yes
  • Is array: no
  • Default: NULL

Options โ€‹

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

new โ€‹

Generates a new forme boilerplate project

Usage โ€‹

  • new [--host HOST] [--vendor VENDOR] [--view VIEW] [--] <type> <name>

๐ŸŒฑ new โ€‹

Generates a new forme boilerplate plugin or theme project.

You need to pass in the type of project you want to generate and a name.

# make a new plugin project
forme new plugin FooBar

# make a new theme project
forme new theme FooBar

This will create a new directory with all the necessary boiler plate code and initialise the git repo for you.

As a default the cli will put the project into the generic App vendor namespace. If you need something else, you can use the --vendor option.

bash
forme new plugin FooBar --vendor=BazQux

You might have different Github users (e.g a work and personal one) and might have assigned different host aliases to them in your git config. If you need to pass a host in to access an alternative github account, you can use the --host option.

bash
forme new plugin FooBar --host=work

You can select a view engine for the project. The code generator supports plates-4, blade, twig or plates. Default is plates-4.

bash
forme new theme FooBar --view=blade

Arguments โ€‹

type โ€‹

The type of project - plugin or theme

  • Is required: yes
  • Is array: no
  • Default: NULL

name โ€‹

The name of the project in Title Case

  • Is required: yes
  • Is array: no
  • Default: NULL

Options โ€‹

--host โ€‹

The github host name if non standard

  • Accept value: yes
  • Is value required: yes
  • Is multiple: no
  • Is negatable: no
  • Default: NULL

--vendor โ€‹

The vendor namespace - defaults to App

  • Accept value: yes
  • Is value required: yes
  • Is multiple: no
  • Is negatable: no
  • Default: NULL

--view โ€‹

The view engine to use - plates-4, blade, twig or plates - defaults to plates-4

  • Accept value: yes
  • Is value required: yes
  • Is multiple: no
  • Is negatable: no
  • Default: NULL

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

test โ€‹

Testing helpers for plugin and theme projects.

Usage โ€‹

  • test [<testCommand> [<args>...]]

๐Ÿงช test โ€‹

You can use test to run one of the following test helper commands within your plugin or theme project directory.

forme test run
# or shorthand
forme test

This runs ./tools/pest under the hood. If you need to pass any arguments to pest, use ./tools/pest instead.

bash
forme test setup

This will create a new wp-test directory if it doesn't already exist, containing a WordPress installation set up for integration and end to end tests, hooked up to an SQLite database, and with your plugin or theme installed via the magic of symlinks. The admin user is admin and the password is password.

forme test server start
forme test server stop

This will start or stop a test server using the basic built-in php server. It will be available to use on [http://localhost:8000]http://localhost:8000. While it's perfectly serviceable as a local development server, bear in mind that the database state won't persist between integration test runs, so don't rely on that aspect of it. If you need something more persistent, use valet or ketch (i.e. docker) instead.

Arguments โ€‹

testCommand โ€‹

E.g. run, server, setup

  • Is required: no
  • Is array: no
  • Default: 'run'

args โ€‹

Arguments to pass to the command

  • Is required: no
  • Is array: yes
  • Default: array ()

Options โ€‹

--help|-h โ€‹

Display help for the given command. When no command is given display help for the list command

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--quiet|-q โ€‹

Do not output any message

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--verbose|-v|-vv|-vvv โ€‹

Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--version|-V โ€‹

Display this application version

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

--ansi|--no-ansi โ€‹

Force (or disable --no-ansi) ANSI output

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: yes
  • Default: NULL

--no-interaction|-n โ€‹

Do not ask any interactive question

  • Accept value: no
  • Is value required: no
  • Is multiple: no
  • Is negatable: no
  • Default: false

Made by Moussa Clarke @ Sanders Web Works with โค๏ธ