codeguy/Slim — Issue #203: Multiple apps in one file
Author: silentworks
Created: 2011-12-27 22:50:13+00:00
State: open

I have tested running multiple apps in index.php file and I get 404 for one app while getting the correct for the other app. This is due to the url not being found in one of the apps, I have tested this on the latest develop branch and its still the same. There seem to be no way of independently separating the routes between apps. Code example below:

$app = new Slim();
$app->setName('frontend');

$admin = new Slim();
$admin->setName('admin');

$app->get('/', function () {
echo "Hello, Dude";
});

$admin->get('/world/:name', function ($name) {
echo "Hello, $name";
});

$app->run();
$admin->run();

This as it is will give a 404 for $admin app upon run if you are at the base url due to no url matching the $admin routes.