src/Transformatika/Config/Config.php
public static function readConfigFile($path = '')
    {
        $path = str_replace('..', '', $path);
        $realPath = self::$configDir . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path);
        $cachedFile = self::$cachePath . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path).'.php';
        if (file_exists($cachedFile) && self::$config['cache'] === true) {
            $conf = require_once($cachedFile);
        } else {
            if (file_exists($realPath)) {
                switch (self::$configExt) {
                    case 'xml':
                        $objConfig = simplexml_load_file($realPath);
                        $conf = json_decode(json_encode($objConfig), true);
                        break;
                    case 'yaml':
                        $conf = Yaml::parse(file_get_contents($realPath));
                        break;
                    default:
                        $conf = require_once $realPath;
                        break;
                }
                if (self::$config['cache'] === true) {
                    touch($cachedFile);
                    $str = "<?php\nreturn ".var_export($conf, true).";\n";
                    file_put_contents($cachedFile, $str);
                }
            }
        }
        return $conf;
    }
public static function readConfigFile($path = '')
    {
        $path = str_replace('..', '', $path);
        $realPath = self::$configDir . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path);
        $cachedFile = self::$cachePath . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path).'.php';
        if (file_exists($cachedFile) && self::$config['cache'] === true) {
            $conf = require_once($cachedFile);
        } else {
            if (file_exists($realPath)) {
                switch (self::$configExt) {
                    case 'xml':
                        $objConfig = simplexml_load_file($realPath);
                        $conf = json_decode(json_encode($objConfig), true);
                        break;
                    case 'yaml':
                        $conf = Yaml::parse(file_get_contents($realPath));
                        break;
                    default:
                        $conf = require_once $realPath;
                        break;
                }
                if (self::$config['cache'] === true) {
                    touch($cachedFile);
                    $str = "<?php\nreturn ".var_export($conf, true).";\n";
                    file_put_contents($cachedFile, $str);
                }
            }
        }
        return $conf;
    }
public static function readConfigFile ( $ path = '' ) { $ path = str_replace ( '..' , '' , $ path ) ; $ realPath = self :: $ configDir . DIRECTORY_SEPARATOR . str_replace ( '/' , DIRECTORY_SEPARATOR , $ path ) ; $ cachedFile = self :: $ cachePath . DIRECTORY_SEPARATOR . str_replace ( '/' , DIRECTORY_SEPARATOR , $ path ) . '.php' ; if ( file_exists ( $ cachedFile ) && self :: $ config [ 'cache' ] === true ) { $ conf = require_once ( $ cachedFile ) ; } else { if ( file_exists ( $ realPath ) ) { switch ( self :: $ configExt ) { case 'xml' : $ objConfig = simplexml_load_file ( $ realPath ) ; $ conf = json_decode ( json_encode ( $ objConfig ) , true ) ; break ; case 'yaml' : $ conf = Yaml :: parse ( file_get_contents ( $ realPath ) ) ; break ; default : $ conf = require_once $ realPath ; break ; } if ( self :: $ config [ 'cache' ] === true ) { touch ( $ cachedFile ) ; $ str = "<?php\nreturn " . var_export ( $ conf , true ) . ";\n" ; file_put_contents ( $ cachedFile , $ str ) ; } } } return $ conf ; }
Read XML Config File

example: readConfigFile('conf.d/usergroup.xml');

@param string $path
@return SimpleXMLElement
Read XML Config File