S
S
semki0962017-10-31 15:17:24
Slim Framework
semki096, 2017-10-31 15:17:24

Why does Slim practice such work with containers (with an example)?

For example, put the controller in a container

$container['UserController'] = function($container) {
  return new App\Controllers\UserController($container);
};

$app->get('/', 'UserController:listUsers');

Why, if it is possible so (that is, immediately call the desired method in the router)?
$app->get('/', 'App\Controllers\UserController:listUsers');

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question