klein / klein.php

A fast & flexible router
MIT License
2.66k stars 290 forks source link

Namespace using multiple countries #306

Open hoffmanns opened 9 years ago

hoffmanns commented 9 years ago

I am trying to use namespaces for multiple countries and use the country to setup a service.

$klein->with("/[at|de:country]", function () use ($klein) {
    // catch all (not called)
    $klein->respond(function($request, $response, $service, $app) {
       // create service based on $request->country
    });
    // specific route, is called
    $klein->respond("articles", function($request, $response, $service, $app) {
    });
});

But the catch all route is never called. If I use $klein->with("/at", function () {});, the catch all route is called as well.

Does klein support using the OR operator for namespaces?

Xenywest commented 8 years ago

+1

rystaf commented 5 years ago

I'm finding that catch-all routes in namespaces don't support any parameters, not just specifically the OR operator.