src/Phug/Partial/ExtensionsTrait.php
public static function addExtension($extensionClassName)
    {
        if (!class_exists($extensionClassName)) {
            throw new PhugException(
                'Invalid '.$extensionClassName.' extension given: '.
                'it must be a class name.'
            );
        }

        if (!static::hasExtension($extensionClassName)) {
            self::$extensions[] = $extensionClassName;

            /* @var Renderer $renderer */
            if ($renderer = self::$renderer) {
                $renderer->setOptionsRecursive(static::getOptions());
            }
        }
    }
public static function addExtension($extensionClassName)
    {
        if (!class_exists($extensionClassName)) {
            throw new PhugException(
                'Invalid '.$extensionClassName.' extension given: '.
                'it must be a class name.'
            );
        }

        if (!static::hasExtension($extensionClassName)) {
            self::$extensions[] = $extensionClassName;

            /* @var Renderer $renderer */
            if ($renderer = self::$renderer) {
                $renderer->setOptionsRecursive(static::getOptions());
            }
        }
    }
Add an extension to the Phug facade (will be available in the current renderer instance and next static calls).
Throws an exception if the extension is not a valid class name.

@param string $extensionClassName

@throws PhugException