13

When I access laravel, it said

Symfony \ Component \ Debug \ Exception \ FatalErrorException
'Krucas\Notification\NotificationServiceProvider' Not found

The Website locations is http://somedomain.com/index.php It's document physical path is :

C:/Apache24/htdocs/new_project/laravel/public/laravel1/public

And I have these setting in

C:/Apache24/htdocs/new_project/laravel/public/laravel1/app/config/app.php

providers array 'Krucas\Notification\NotificationServiceProvider'

Alias Array 'Notification'=> 'Krucas\Notification\Facades\Notification'

How can I know the Laravel maps the provider array and alias array to the physical path?

4givN
  • 2,936
  • 2
  • 22
  • 51
Peter Hon
  • 257
  • 3
  • 4
  • 14

3 Answers3

23

There were some cases with registration problem, cache issues, etc. Try one of these solutions:

  • register your provider (in main composer.json, then in config/app.php [provider & alias] ), then run composer dump-autoload
  • try php artisan config:cache or delete everything in bootstrap/cache/
  • make sure you have initiated your package : go to the folder, then composer init
4givN
  • 2,936
  • 2
  • 22
  • 51
6

After adding the dependency in composer.json, you have to install the package before adding the class in service provider, using the below command:

composer update

You can easily check if the physical file(NotificationServiceProvider) exists in your project. If it does not exists, you need to install the package using above command(don't forget to comment out the service provider declaration in app.php and re-enable after installing the package.)

Shafiul
  • 1,452
  • 14
  • 21
0

If you followed all the suggestions above and still have an issue, consider checking the case for your namespace, author name, or naming of your service provider. It is case sensitive, primarily if you are registering it manually in config/app.php

I had a similar issue, and it took me a while to realize it was a case-sensitive issue.

Example:

Wrong: MyName\Something\SomethingServiceProvider::class

Correct: Myname\Something...

So the problem was with Myname as it is case-sensitive.

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
Prosper
  • 19
  • 1