Example #1
0
}
// Check if we are running high enough PHP version
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
    echo 'The PHP version you are running (' . PHP_VERSION . ') is not sufficient for WildPHP. Sorry.';
    echo 'Please use PHP 5.5.0 or later.';
    exit(129);
}
// Define global constants
define('WPHP_ROOT_DIR', __DIR__ . '/');
define('WPHP_LIB_DIR', WPHP_ROOT_DIR . 'lib/');
define('WPHP_MODULE_DIR', WPHP_ROOT_DIR . 'modules/');
define('WPHP_LOG_DIR', WPHP_ROOT_DIR . 'logs/');
define('WPHP_CONFIG', WPHP_ROOT_DIR . 'config.neon');
// Turn all PHP errors into exceptions
set_error_handler(function ($errNo, $errStr, $errFile, $errLine) {
    throw new ErrorException($errStr . ' in ' . $errFile . ' on line ' . $errLine, $errNo);
});
// Register the autoloader
require_once 'vendor/autoload.php';
// Create a new bot and start it up
$bot = new Bot();
$parser = new DotModulesParser();
$result = $parser->readFile(dirname(__FILE__) . '/main.modules');
if (!empty($result)) {
    $router = new DotModulesRouter();
    $modules = $router->routeAll($result);
    if (!empty($modules)) {
        $bot->addModules($modules);
    }
}
$bot->start();