Skip to content

Instantly share code, notes, and snippets.

@BinaryKitten
Last active December 12, 2015 01:28
Show Gist options
  • Save BinaryKitten/4691448 to your computer and use it in GitHub Desktop.
Save BinaryKitten/4691448 to your computer and use it in GitHub Desktop.
<?php
use Zend\Stdlib\ArrayUtils;
//.....
public function getConfig()
{
$config = array();
$folder = realpath(__DIR__ . '/config');
$iterator = new DirectoryIterator($folder);
$filteredIterator = new RegexIterator($iterator,'/\\.config.php$/i');
foreach($filteredIterator as $file) {
$name = str_replace('.config.php', '', $file->getFilename();
$config[$name] = include($file->getPathname());
}
return $config
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment