Initialize MODX in external file in 3.0

I’ve been using this code to initialize MODX in external files:

require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
require_once MODX_CORE_PATH.'model/modx/modx.class.php';

// Create an instance of the MODx core
$modx = new modX();

// Initialise the core to access the default 'web' context
$modx->initialize('web');

Are there any adjustments or recommended changes for MODX 3.0?

Maybe try the code from here:

https://docs.modx.com/3.x/en/extending-modx/modx-class/loading-externally

It seems the documentation was adjusted for MODX 3.

Great, thanks. That makes sense.

Depending on what you’re doing, you may also need to initialize the error system, $modx->user, and/or $modx->resource.

Some more options and sample code here.

Thanks for the very thorough options!