(by Artful Magpie)
Choclo is a two-step configuration framework.
This is a PoC. DO NOT USE IT IN PRODUCTION.
use Guide42\Choclo\Configurator;
class MyApp extends Configurator
{
const PHASE_ROUTES = 60;
public function addRoute($name, $pattern, \Closure $controller)
{
$connect = function() use ($name, $pattern, $controller) {
$route = new Route($pattern, array(
'_controller' => $controller,
));
$routes = $this->getRegistry()->get('Symfony\Component\Routing\RouteCollection');
$routes->add($name, $route);
};
$this->register('route-' . $name, $connect, self::PHASE_ROUTES);
}
}