Is it possible to create single instance of the class, which will be used in all routes. For example I have this code:
$app = new \Slim\Slim([
        'mode'  => 'development',
        'debug' => true
    ]);
    use App\API;
    $API = new API;
$app->get('/', function () {
    $API->insertMessage();
});
$app->run();
At the moment this is not working, I need to put $API = new API inside get request.
 
     
    