Warning: This question is Laravel 4 specific.
I\'ve been using Facades in my controllers before. Therefore I know the code is working. Now I need to
For me it was just a matter of running
php artisan optimize:clear
Got it fixed. All the tutorials about dependency injection were referring to concrete implementations of interfaces so that I thought that's the way to go about it. Joseph Silber's
answer got me on the right track.
The trick is to bind the Interface to the binding of the ServiceProvider
like shown below. That way Laravel will know how to instantiate the Helpers service.
File: app/start/global.php
<?php
// ...
App::bind('Acme\Interfaces\HelpersInterface', 'helpers');
It seems your Acme\Services\Helpers
constructor takes a $name
parameter, but is not type hinted.
Laravel's IoC is not magic. If your don't provide a type hint for every parameter, the IoC container has no way of knowing what to pass in.