I'm developing a package for Laravel 5.1 and I've already identified a problem that I could not find the solution for.
Displays the following error:
FatalErrorException in ProviderRepository.php line 146:
Class 'MyNamespace\MyApp\MyAppServiceProvider' not found
However, it does not work at all, just code me.
composer.json
...
"psr-4": {
"MyNamespace\MyApp\": "vendor/mynamespace/myapp/src/"
}
...
vendor / mynamespace / myapp / src / MyAppServiceProvider.php
<?php
namespace MyNamespace\MyApp;
use Illuminate\Support\ServiceProvider;
class MyAppServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
require __DIR__ . '/../vendor/autoload.php';
if (! $this->app->routesAreCached()) {
require __DIR__.'/../../routes.php';
}
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
}
And finally, I try to register my ServiceProvider, but ...
config / app.php
'providers' => [
...
MyNamespace\MyApp\MyAppServiceProvider::class
],
But it did not roll, it displays the error quoted at the beginning of the post.