static public function register()
    {
        // only register once
        if (static::$registered === true) {
            return true;
        }
        $kirby = kirby();
        if (!class_exists('Kirby\Component\Template')) {
            throw new Exception('The Kirby Twig plugin requires Kirby 2.3 or higher. Current version: ' . $kirby->version());
        }
        if (!class_exists('Twig_Environment')) {
            require_once __DIR__.'/../lib/Twig/lib/Twig/Autoloader.php';
            \Twig_Autoloader::register();
        }
        $kirby->set('component', 'template', 'Kirby\Twig\TwigComponent');
        if (is_executable('twig') === false) {
            require_once __DIR__ . '/helpers.php';
        }
        return static::$registered = true;
    }