Domain and subdomain routing

I’m trying to make an app that includes routing on the subdomain. I’ve seen the response at Subdomains control for url in slim but it seems a bit messy to have what’s essentially my routing logic split between two different systems (nginx & slim).

I was looking at how laravel does it but can’t come up with a semi-neat workaround for slim.
The goal would be code like

// Based on laravel $app->group(array('domain' => 'example.com'), function($request, $response) use ($app) { $app->get('/', function($request, $response) { $response->getBody()->write("Welcome to the splash page for our product"); return $response; }); }); $app->group(array('domain' => 'admin.example.com'), function($request, $response) use ($app) { $app->get('/', function($request, $response) { $response->getBody()->write("Admin page with some functions"); return $response; }); }); $app->group(array('domain' => '{client}.example.com'), function($request, $response) use ($app) { $app->get('/', function($request, $response) { $client = $request->getAttribute('client'); $response->getBody()->write("Welcome to your app " . $client); return $response; }); }); 

Any ideas on how to achieve this kind of neatly, or if it’s possible?
Cheers

Currently not possible.