Mostafa Talebi
Mostafa Talebi

Reputation: 9183

Laravel service provider could not be found. why?

I have problem for my service provider.

I have made a folder called library. Autoloaded it. Everything fine. Every class that I add here works just fine. Now, I want to make Facades.

My class is HT()

Then I made a file with the following content in it:

class HTServiceProvider extends ServiceProvider
{

    public function register()
    {
        $this->app->bind('\Aone\HTML_NS\HT', function()
        {
            return new HT; // Name of your class, be sure to include the namespace     if you are using one.
        });
    }
}

But when I add that to app.php ServiceProviders array, it throws the following error:

 Class 'Illuminate\Support\ServiceProvider\HTServiceProvider' not found 

Here is the line added to app.php:

"Illuminate\Support\ServiceProvider\HTServiceProvider",

Also I added the namespace to the app() bind.

What am I doing wrong here?

Upvotes: 0

Views: 1760

Answers (1)

Jarek Tkaczyk
Jarek Tkaczyk

Reputation: 81167

probably you just need to namespace it:

$this->app->bind('Your\Namespace\HT', function()

Upvotes: 1

Related Questions