0

I've registered a service provider in config/app.php, it's being loaded and executed.

In the service provider register() method:

\App::bind("timer", function() { 
    return new Foo\Utils\Timer(); 
});

Next, i have created the facade like this

<?php namespace Foo\Facades;

use Illuminate\Support\Facades\Facade;

class Timer extends Facade {
    protected static function getFacadeAccessor() { return 'timer'; }
}

Next, i've added the facade implementation

<?php namespace Foo\Utils;

use Illuminate\Support\Facades\Log;

class Timer {
    function test() {}
}

Finally, i've added the alias in config/app.php

'Timer' => 'Foo\Facades\Timer'

When i do

\Timer::test();

i get the following

exception 'ReflectionException' with message 'Class timer does not exist'

Whats wrong?

EDIT

Foo\Facades\Timer is being loaded properly.

Also, Foo\Utils\Timer is being resolved since i am able to do

$timer = new Foo\Utils\Timer();
$timer->test();

without any errors.

brazorf
  • 1,943
  • 2
  • 32
  • 52

0 Answers0