-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"mount" one by one #156
Comments
Seems to work using Bramus version <?php
// Require composer autoloader
require __DIR__ . '/vendor/autoload.php';
// Create Router instance
$router = new \Bramus\Router\Router();
$router->mount('/api/v1', function () use ($router) {
$router->get('/', function() { echo 'API version 1 overview'; });
$router->get('add', function() { echo 'API version 1 add something'; });
});
$router->mount('/api/v2', function () use ($router) {
$router->get('/', function() { echo 'API version 2 overview'; });
$router->get('add', function() { echo 'API version 2 add something'; });
});
$router->set404(function() {
header('HTTP/1.1 404 Not Found');
echo "404";
});
// Run it!
$router->run(); |
Sorry, I forgot one small detail, but very important
The second "setNamespace" overrides the previous one and ends up with the wrong path to the class |
You're right. The current project structure does not allow that because |
|
How do I use "mount" one by one? The last one cancels the previous one.
$router->mount('/api/v1', function () use ($router) {});
doesn't work$router->mount('/api/v2', function () use ($router) {});
worksThe text was updated successfully, but these errors were encountered: