Laravel package development

℡╲_俬逩灬. 提交于 2019-12-25 16:57:05

问题


I am trying to develop a Laravel package with a helper function, which returns a view. I have uploaded on GitHub already https://github.com/faisalahsan/laravel-breadcrums. When I install it through Packagist https://packagist.org/packages/faisalahsanse/laravel-breadcrums, it installs successfully, but when I register it in the provider array in my app.php as Faisalahsanse\Breadcrums\BreadcumsServiceProvider::class,. It gives the following error:

Class 'Faisalahsanse\Breadcrums\BreadcumsServiceProvider' not found

I don't know where I am getting wrong.

Any suggestions?


回答1:


Your namespace is wrong https://github.com/faisalahsan/laravel-breadcrums/blob/master/src/BreadcumsServiceProvider.php#L2

It should be Faisalahsan\LaravelBreadcrums. As this namespace you are adding in the composer.json file in psr-4 autoload.

Also your provider to add will be Faisalahsan\Breadcrums\BreadcumsServiceProvider::class



来源:https://stackoverflow.com/questions/34172047/laravel-package-development

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!