| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
You can use the "builders" to create the PHP code for the route declaration. The builders are using as input arrays that are created from ExportInterface::toArray().
use Ertuo\Route;
use Ertuo\Builder\BuilderWithArrays;
$routes = Route::add('_app')->...
$php = (new BuilderWithArrays)->buildTree( $routes->toArray() );
file_put_contents('/somewhere/where/routes/live/routes.php', $php);There are so far several builders:
The generated code from BuilderWithArrays for the route tree looks something like this:
use Ertuo\Route;
return $routes = Route::add('_app', [])
->rule('enum', ['api', 'admin', ], [])->default('web', [])
->group(function()
{
return array(
'' => Route::add('_locale', [])
->rule('enum', ['en', 'de', ], [])->default('en', [])
->group(function()
{
return array( ... );
})
);
}); | Back | FazBrowse Home | New Git URL |