modX.addExtensionPackage
Last updated not available | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn moremodX::addExtensionPackage¶
Writes a package entry into the extension_packages system setting, creating the setting first when it does not exist. The stored value is a JSON array: each entry maps a package name to its options and stores the path under the path key.
The package loads on the next initialization, not in the running request: the settings cache must be refreshed first. Then initialize() reads the setting, expands path tokens such as [[++core_path]] and calls xPDO::addPackage().
The package classes become available to loadClass(), newObject() and getTableName(). serviceName and serviceClass go to xPDO::getService(), which is itself deprecated in favour of the service container.
The core marked the setting-based store deprecated in 2.3; modExtensionPackage records replace it. The code still announces a removal that never happened, so the setting keeps working in this version.
Syntax¶
boolean addExtensionPackage (string $name, string $path, [array $options = array()])
-
$name(string) package name, used as the key of the entry -
$path(string) directory that holds the package model -
$options(array)tablePrefix,serviceNameandserviceClassvalues, by defaultarray()
Example¶
$modx->addExtensionPackage('mypkg', MODX_CORE_PATH . 'components/mypkg/model/', array(
'tablePrefix' => 'mypkg_',
));
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










