The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Upgrading to Slim Extras 2+

So you have taken the bold step of moving over to Slim 2+, now you want to take that same step with the extras, the only issue is it seems this namespacing thing have broken your application and you don't know where to start as to fix it. It seem like a long tedious task to start changing you class names just because the framework has decided to move forward.

Do not worry at all, it is easier than you think to upgrade to Slim Extras 2+, it is just about as easy as it is to do so for Slim 2+, I will show you how easy it is to move your existing extras view classes over.

Your current app looks like this (maybe):

require 'Slim/Slim.php';
require 'Views/TwigView.php';

$app = new Slim(array(
    'view' => new TwigView,
));

$app->get('/', function () use ($app) {
    $app->render('hello.html');
});

So here is the problem, we have moved over to PHP 5.3 namespacing so we don't need to be append View to the class name anymore, so this leaves use with a class called Twig, I guess one of your question might be won't this cause class collision? no it wont due to us using namespacing. Your other question might be, does this mean I will have to change my class instantiation? no you dont and I will show you how to achieve this.

require 'Slim/Slim.php';
use Slim\Slim;
Slim::registerAutoloader();

require 'Extras/Views/Twig.php';
use Slim\Extras\View\Twig as TwigView;

$app = new Slim(array(
    'view' => new TwigView,
));

$app->get('/', function () use ($app) {
    $app->render('hello.html');
});

Did you see what I just did? I just aliased the class in the use statement to TwigView, now we don't need to change our instantiation of the class.