slimphp / Slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
http://slimframework.com
MIT License
11.94k stars 1.95k forks source link

DI Required services missing `CallableResolver` #1591

Closed michaelboke closed 8 years ago

michaelboke commented 8 years ago

Hi, i'm using the DI container from league and not the builtin provided by Slim 3 rc2. I followed the documentation and added all the required services.

When i run the skeleton app i get a exception thrown by the container that the service callableResolver not being managed by the container. There is nothing in the documentation stating that this service is required.

I added the missing service and inject it with the container (league)

$container->share('callableResolver', \Slim\CallableResolver::class)
    ->withArgument($container);

I have found that the Slim\CallableResolverAwareTrait method resolveCallable is trying to get the callable resolver from the container. this trait is used by Slim\App.

Documentation at fault ? hidden dependency or am i missing something here.

mathmarques commented 8 years ago

callableResolver is a required service: https://github.com/slimphp/Slim/blob/3.x/Slim/Container.php#L230

It was missing on doc

silentworks commented 8 years ago

Added to the docs thanks to @mathmarques

michaelboke commented 8 years ago

Thanks.