xp_import

xp_import($name[, $dir = false])

Import a module for usage.

By default modules will be loaded from the modules/ directory located within XPSPL.

Parameters:
  • string – Module name.
  • string|null – Location of the module.
Return type:

void

Example #1 Basic Usage

<?php

// Import the time module
xp_import('time');

Example #2 Importing modules from user-defined directories

<?php

// Import the "foobar" module from our custom module directory
xp_import('foobar', '/my-custom/directory/path');