Skip to content

Commit

Permalink
Added route loader
Browse files Browse the repository at this point in the history
  • Loading branch information
simba77 committed Feb 3, 2024
1 parent 0dfaa80 commit 71af8df
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions system/src/Router/RouteLoader.php
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Johncms\Router;

class RouteLoader
{
public function load(): RouteCollection
{
$routeCollection = new RouteCollection();
$routerConfigs = glob(MODULES_PATH . '*/*/config/routes.php');
foreach ($routerConfigs as $routerConfig) {
(require $routerConfig)($routeCollection);
}

return $routeCollection;
}
}

0 comments on commit 71af8df

Please sign in to comment.