1
I am developing a package for Laravel 5.1 and I have identified a problem that I could not find the solution.
Displays the following error:
FatalErrorException in ProviderRepository.php line 146:
Class 'MyNamespace\MyApp\MyAppServiceProvider' not found
However, it doesn’t work at all, me code.
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 not rolled, presents the error quoted at the beginning of the post.
Blz, concerning the
composer dump-autoload
it was executed, however, the error persisted. I modified the structure - I took it from the vendor - and everything flowed accordingly. Thank you!!!– Ewerton Melo