MODX Shell

Getting started

Installation

  1. Clone the repository git clone https://github.com/meltingmedia/MODX-Shell.git
  2. Install dependencies cd MODX-Shell && composer install --no-dev
  3. Optionally add bin/modx to your $PATH so you could use modx command from anywhere, by running ln -s /path/to/bin/modx ~/bin/modx

Then, you should be able to run modx from anywhere.

When running modx command with no parameter, you will get the list of available commands.
Those commands could change if there is a modX instance configured or not.

If you use bash, you might be interested in commands auto completion

Adding a modX instance

A configuration basically consist of a name and a path.

You could list your configured instances using the command modx config:list.
When being in a folder (or sub-folder) matching an existing configuration, you will notice a > in front of the configuration name.

To add a new entry in your configuration (which is basically just a .ini file), you can make use of the command modx config:add :

Usage:
 config:add name [path] [erase]

Arguments:
 name                  Your instance name
 path                  Your instance base path, defaults to current dir (default: "/current/path")
 erase                 Whether or not override existing configuration (default: false)

If a config.core.php is found at the root path you set in your configuration, and a valid MODX configuration is set (basically a MODX_CORE_PATH constant defining a valide modX core folder, as well as a MODX_CONFIG_KEY), you will be able to use the configured modX instance.

Your configuration file is stored within your $HOME/.modx/config.ini