Did you include your provider in the array in config/app.php?
Laravel 5 package ServiceProvider can't be found!
Hi guys,
I'm working on my first Laravle 5 package, but Laravel can't find the ServiceProvider. I'm sure I have the psr-4 stuff correct and the package is pulled in correct.
I placed the link to the service provider in my config/app.php file
"blackbirddev/entry": "dev-master"
I get the error when I run php artisan vendor:publish. When I do this it should publish my config file, but instead I get this error:
`PHP Fatal error: Class 'Blackbirddev\Entry\EntryServiceProvider' not found in /
vagrant/public/laravel5/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 150'
Here is the code:
composer.json
"autoload": {
"psr-4": {
"Blackbird\\Entry\\": "src/Entry"
}
}
EntryServiceProvider.php
<?php namespace Blackbirddev\Entry;
use Illuminate\Support\ServiceProvider;
class EntryServiceProvider extends ServiceProvider {
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->publishes([
__DIR__.'/../config/config.php' => config_path('entry.php'),
]);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('entrust', function ($app) {
return new Entry($app);
});
}
}
If you need anything else let me know ;)
Managed to fix it. It was a namespace problem
autoload": {
"psr-4": {
"Blackbird\\Entry\\": "src/Entry"
}
}
Should be
autoload": {
"psr-4": {
"Blackbirddev\\Entry\\": "src/Entry"
}
}
Please or to participate in this conversation.