'L5 service providers not loading

Problem

Love L5. But last 24h been a nightmare. None of my 3rd party service providers (SP) are loading. I did a clean install of L5 and tried adding the SPs but still not working.

The SPs install as they should in the vendor folder when running composer update. But when running the L5 I get the error message Class 'LaravelLocalization' not found

composer.json

"require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.2.*",
    "twbs/bootstrap": "*",
    "intervention/image": "*",
    "laravelcollective/html": "*",
    "barryvdh/laravel-debugbar": "*",
    "davibennun/laravel-push-notification": "dev-laravel5",
    "mcamara/laravel-localization": "1.1.*",
    "tijsverkoyen/css-to-inline-styles": "1.5.5",
    "league/csv": "*"
}, 

app.config

providers

    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    Illuminate\Bus\BusServiceProvider::class,
    Illuminate\Cache\CacheServiceProvider::class,
    Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
    Illuminate\Cookie\CookieServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    Illuminate\Encryption\EncryptionServiceProvider::class,
    Illuminate\Filesystem\FilesystemServiceProvider::class,
    Illuminate\Foundation\Providers\FoundationServiceProvider::class,
    Illuminate\Hashing\HashServiceProvider::class,
    Illuminate\Mail\MailServiceProvider::class,
    Illuminate\Pagination\PaginationServiceProvider::class,
    Illuminate\Pipeline\PipelineServiceProvider::class,
    Illuminate\Queue\QueueServiceProvider::class,
    Illuminate\Redis\RedisServiceProvider::class,
    Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
    Illuminate\Session\SessionServiceProvider::class,
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    Collective\Html\HtmlServiceProvider::class,

    /*
     * Application Service Providers...
     */
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,

    /*
     * 3rd Party Service Providers...
     */
    Barryvdh\Debugbar\ServiceProvider::class,
    Intervention\Image\ImageServiceProvider::class,
    Davibennun\LaravelPushNotification\LaravelPushNotificationServiceProvider::class,
    Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider::class

aliases

    'App'       => Illuminate\Support\Facades\App::class,
    'Artisan'   => Illuminate\Support\Facades\Artisan::class,
    'Auth'      => Illuminate\Support\Facades\Auth::class,
    'Blade'     => Illuminate\Support\Facades\Blade::class,
    'Cache'     => Illuminate\Support\Facades\Cache::class,
    'Config'    => Illuminate\Support\Facades\Config::class,
    'Cookie'    => Illuminate\Support\Facades\Cookie::class,
    'Crypt'     => Illuminate\Support\Facades\Crypt::class,
    'DB'        => Illuminate\Support\Facades\DB::class,
    'Eloquent'  => Illuminate\Database\Eloquent\Model::class,
    'Event'     => Illuminate\Support\Facades\Event::class,
    'File'      => Illuminate\Support\Facades\File::class,
    'Gate'      => Illuminate\Support\Facades\Gate::class,
    'Hash'      => Illuminate\Support\Facades\Hash::class,
    'Lang'      => Illuminate\Support\Facades\Lang::class,
    'Log'       => Illuminate\Support\Facades\Log::class,
    'Mail'      => Illuminate\Support\Facades\Mail::class,
    'Password'  => Illuminate\Support\Facades\Password::class,
    'Queue'     => Illuminate\Support\Facades\Queue::class,
    'Redirect'  => Illuminate\Support\Facades\Redirect::class,
    'Redis'     => Illuminate\Support\Facades\Redis::class,
    'Request'   => Illuminate\Support\Facades\Request::class,
    'Response'  => Illuminate\Support\Facades\Response::class,
    'Route'     => Illuminate\Support\Facades\Route::class,
    'Schema'    => Illuminate\Support\Facades\Schema::class,
    'Session'   => Illuminate\Support\Facades\Session::class,
    'Storage'   => Illuminate\Support\Facades\Storage::class,
    'URL'       => Illuminate\Support\Facades\URL::class,
    'Validator' => Illuminate\Support\Facades\Validator::class,
    'View'      => Illuminate\Support\Facades\View::class,
    'Form'      => Collective\Html\FormFacade::class,
    'Html'      => Collective\Html\HtmlFacade::class,
    'Debugbar'  => Barryvdh\Debugbar\Facade::class,
    'Image'     => Intervention\Image\Facades\Image::class,
    'PushNotification' => Davibennun\LaravelPushNotification\Facades\PushNotification::class,
    'LaravelLocalization'   => Mcamara\LaravelLocalization\Facades\LaravelLocalization::class

Things I tried

Laravel 5.2 Service provider not booting

php artisan clear-compiled composer dump-autoload php artisan optimize

Laravel - Composer unable to find the service provider class

composer clear

I've also scorched the internet but come up dry.. :( https://laracasts.com/discuss/channels/general-discussion/laravel-5-package-serviceprovider-cant-be-found)

Ideas?

Any ideas how to overcome greatly appreciated. Cannot run the app now and lost a day of work.. :/

UPDATE

The autoload_files.php in vendor/composer does NOT contain some of the frameworks. barryvdh/laravel-debugbar is part of it (does not get loaded) but for instance Mcamara\LaravelLocalization is NOT part of the autoload_files.

But the Mcamara\LaravelLocalization is part of the autoload_static.php under $prefixesPsr0 - if that helps?

autoload_files.php (in /vendor/composer/)

return array(
    '1d1b89d124cc9cb8219922c9d5569199' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest.php',
    '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
    '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
    'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php',
    '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
    'e7223560d890eab89cda23685e711e2c' => $vendorDir . '/psy/psysh/src/Psy/functions.php',
    '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
    'f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
    '58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',
    'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
    'f18cc91337d49233e5754e93f3ed9ec3' => $vendorDir . '/laravelcollective/html/src/helpers.php',
    '4a1f389d6ce373bda9e57857d3b61c84' => $vendorDir . '/barryvdh/laravel-debugbar/src/helpers.php',

);

SOLUTION

A THIRD clean install of L5 where I add in the SPs ONE by ONE seems to work. Just happy to be back on track. Cannot thank everyone enough - big shout out to @MikeBarwick who provided good guidance throughout - THANKS! :)



Solution 1:[1]

Try this:

composer dump-autoload --optimize

Solution 2:[2]

It's because your are missing class in providers file

$this->app->register(\L5Swagger\L5SwaggerServiceProvider::class);

Paste it under register hope so it will start working.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alfredo EM
Solution 2 S.B