$app->get('......',....)
$container=$this->getContainer();
Is there any difference between the following? Pimple docs uses the former while slim examples the latter. Is any of the two considered more formal in PSR terms?
$server=$container['App\Model\Server'];
$server=$container->get('App\Model\Server');
Slims Container implements the Interop/ContainerInterface, whereas Pimple does not. The Interop/ContainerInterface requires the container to have two methods: get()
and has()
. get()
throws an exception (NotFoundException
) when an entry is not found. With plain Pimple you only get a notice.