I'm making a Laravel ServiceProvider for a package. The package is https://github.com/sumocoders/Teamleader
I get the following error
FatalErrorException in ProviderRepository.php line 150: Class 'Notflip\Teamleader\TeamleaderServiceProvider' not found
I have no clue what I'm doing wrong, Here's my folder structure
composer.json in my package
"autoload": {
"psr-4": {
"Notflip\\Teamleader": "src/"
}
}
TeamleaderServiceProvider
<?php namespace Teamleader\Laravel;
use Illuminate\Support\ServiceProvider;
class TeamleaderServiceProvider extends ServiceProvider
{
/**
* Register bindings in the container.
*
* @return void
*/
public function publishes()
{
$this->publishes([
__DIR__.'/Config/config.php' => config_path('teamleader.php'),
]);
}
public function register()
{
$this->app->bind('Teamleader\Laravel', function () {
return new Teamleader(config('teamleader.API_GROUP'), config('teamleader.API_SECRET'), config('teamleader.SSL'));
});
}
}
Facade
<?php namespace Teamleader\Laravel\Facade;
class Teamleader extends Facade
{
protected static function getFacadeAccessor()
{
return 'Teamleader';
}
}
In my config.php I added the following line to the providers
'Notflip\Teamleader\TeamleaderServiceProvider',
And this line to the aliasses
'Teamleader'=> 'Notflip\Teamleader\Facade\Teamleader'
Anyone has any idea what I might be doing wrong? Thank you! I'm so close to the result!
Your definition in composer is missing the initial slashes and you haven't specified the path to src from root.
Also your declaration of the name space at the top of TeamleaderServiceProvider is wrong, it should be: