modCLI is a wrapper for the MODX Revolution Processors, allowing you to pretty much do anything from the commandline that you would normally do within the manager.
To use modCLI, simply download the modcli.php file and put it in the MODX_BASE_PATH of your installation. Next open up the console or terminal, and start firing some commands at it.
php modcli.php <processor> [field=value [field=value]..]
The needs to be a valid processor in your core/model/modx/processors/ directory, minus the extension. Specifying field=value pairs will pass these on as properties to the processor, just like using AJAX in the manager would.
By specifying the "debug" keyword anywhere in the command, you will get to see a bit more of information. By specifying a processors_path=/absolute/path/to/processors/ you can override the path to look in for processors, for example to hit up a processor belonging to a different package.
Input:
php modcli.php resource/create pagetitle=Awesome! parent=6 content=Awesomer!
Output:
# Running modCLI 0.1.0-pl in modcli.php
# Processor: resource/create
# Properties:
# pagetitle => Awesome!
# parent => 6
# content => Awesomer!
> Object retrieved:
> id => 20
Input:
php modcli.php resource/create pagetitle=Awesome! parent=6 content=Awesomer! debug
Output:
# Running modCLI 0.1.0-pl in modcli.php
# Debug is enabled.
# Processor: resource/create
# Properties:
# pagetitle => Awesome!
# parent => 6
# content => Awesomer!
> Raw response: Array
(
[success] => 1
[message] =>
[total] => 0
[errors] => Array
(
)
[object] => Array
(
[id] => 21
)
)
> Response type: get
> Object retrieved:
> id => 21
```
Input:
php modcli.php workspace/packages/getlist limit=1 start=2
Output:
Amount of Results: 8 Result 1: signature => login-1.8.1-pl created => Sep 07, 2012 12:59 AM updated => Sep 07, 2012 01:01 AM installed => Sep 07, 2012 01:01 AM state => 0 workspace => 1 provider => 0 disabled => source => login-1.8.1-pl.transport.zip manifest => package_name => login version_major => 1 version_minor => 8 version_patch => 1 release => pl release_index => 0 provider_name => name => login version => 1.8.1 iconaction => icon-uninstall textaction => Uninstall readme => --------------------
Snippet: Login
--------------------
Version: 1.7
Sin... updateable =>
## Limitations
Currently, the properties only support a single word. Multi-word properties are on the roadmap but need to be implemented.
Hi @Mark-H now that
define('MODX_API_MODE', true);is deprecated, how archive the same behaviour without login?