How to call a class in your Slim Framework?

$app->get('/', function (Request $request, Response $response, array $args) {
 $response->getBody()->write("Main"); // works

 $mod = \Model\MyModel();
$mod->go();

 return $response;
});


The startup class via Composer connected:
"autoload": {
 "psr-4": {
 "Model\\": "model/"
}
 }

On the screen error, the error and the namespace and class name written in lowercase letters, and my name was the title:
Fatal error: Call to undefined function model\mymodel() in

Tried the class and namespace name to lowercase did not help. But still I wonder why, he had them somewhere inside converts?
June 8th 19 at 16:40
1 answer
June 8th 19 at 16:42
Solution
So you class or function connected?
Maybe just new forgot?
Yes new forgot, thank you. There is a good article on the architecture of the slim application. Ie framework only gave me the frame (router + middleware) how to organize the content inside?
Looked VIDOS with just some require_once DB inside figachat is not our way... - Elwyn_Rutherford commented on June 8th 19 at 16:45
, well, this is "economy class", a series of micro =)
There is nothing more there. I work DB put a separate package (from eloquent lark) - Lulu_Zulauf71 commented on June 8th 19 at 16:48

Find more questions by tags Slim Framework