Akshay K H
Akshay K H

Reputation: 147

how to load custom classes using slim middleware in slim framework from a folder to routes

below is my example routes i have a custom class called Category but am getting error like this Class 'app\Category' not found

 $app->get('/category',function($request, $response, $args){
        $categories = new app\Category();
        $categories->getCategories();

    });

how to load this class in order to make use of it in slim framework V3

Upvotes: 1

Views: 643

Answers (1)

Akshay K H
Akshay K H

Reputation: 147

Got it loaded through composer autoloader by adding autoload block in composer.json

Upvotes: 1

Related Questions