php - Laravel 5 Custom ServiceProvider not found -
i'm making laravel serviceprovider package. package https://github.com/sumocoders/teamleader
i following error
fatalerrorexception in providerrepository.php line 150: class 'notflip\teamleader\teamleaderserviceprovider' not found
i have no clue i'm doing wrong, here's folder structure
composer.json in package
"autoload": { "psr-4": { "notflip\\teamleader": "src/" } }
teamleaderserviceprovider
<?php namespace teamleader\laravel; use illuminate\support\serviceprovider; class teamleaderserviceprovider extends serviceprovider { /** * register bindings in 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 config.php added following line providers
'notflip\teamleader\teamleaderserviceprovider',
and line aliasses
'teamleader'=> 'notflip\teamleader\facade\teamleader'
anyone has idea might doing wrong? thank you! i'm close result!
your definition in composer missing initial slashes , haven't specified path src root.
"psr-4": { "\\notflip\\teamleader": "notflip/teamleader-laravel/src/" }
also declaration of name space @ top of teamleaderserviceprovider wrong, should be:
<?php namespace notflip\teamleader;
Comments
Post a Comment