Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

olamilekan oshodi
olamilekan oshodi
959 Points

PHP Slim composer - Not Found

Hello, Am just in the middle of Build A Basic PHP Website and Hempton was using Slim Framework, everything is going fine until i get to installing Slim. Hempton used v2 in the tutorial and have manage to include the "^3.0" in my composer.json file.

here:

{
    "name": "root/workspace",
    "require": {
        "slim/slim": "^3.3"
    },
    "authors": [
        {
            "name": "Olamilekan Oshodi",
            "email": "*****ter@gmail.com"
        }
    ]
}

Here is the my index file code.

<?php

require 'vendor/autoload.php';
//date_default_timezone_set('Europe/London');


//$log = new Monolog\Logger('name');
//$log->pushHandler(new Monolog\Handler\StreamHandler('app.txt', Monolog\Logger::WARNING));

// installing Slim Framework
$app = new Slim\App();

// Slim Framework routing
$app->get('/hello/{name}', function ($name) {
    echo "Hello, $name";
});

$app->run();

//here is the error am getting.
Fatal error: Uncaught Error: Class 'Slim\App' not found in /home/treehouse/workspace/index.php:11 Stack trace: #0 {main} thrown in /home/treehouse/workspace/index.php on line 11

Is there some thing am not adding to it, or missing? please help.

Hey! I'm sorry but I don't much about using Slim. Here is a support page for Slim:

Slim support page

I hope this helps.