>问题
爱L5。但最后24小时是一场噩梦。我的第三方服务提供商 (SP) 均未加载。我完成了 L5 的全新安装并尝试添加 SP,但仍然无法正常工作。
运行 composer update
时,SP 将按原样安装在 vendor
文件夹中。但是在运行L5时,我收到错误消息Class 'LaravelLocalization' not found
作曲家.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": "*"
},
应用配置
版供应商
/*
* Laravel Framework Service Providers...
*/
IlluminateAuthAuthServiceProvider::class,
IlluminateBroadcastingBroadcastServiceProvider::class,
IlluminateBusBusServiceProvider::class,
IlluminateCacheCacheServiceProvider::class,
IlluminateFoundationProvidersConsoleSupportServiceProvider::class,
IlluminateCookieCookieServiceProvider::class,
IlluminateDatabaseDatabaseServiceProvider::class,
IlluminateEncryptionEncryptionServiceProvider::class,
IlluminateFilesystemFilesystemServiceProvider::class,
IlluminateFoundationProvidersFoundationServiceProvider::class,
IlluminateHashingHashServiceProvider::class,
IlluminateMailMailServiceProvider::class,
IlluminatePaginationPaginationServiceProvider::class,
IlluminatePipelinePipelineServiceProvider::class,
IlluminateQueueQueueServiceProvider::class,
IlluminateRedisRedisServiceProvider::class,
IlluminateAuthPasswordsPasswordResetServiceProvider::class,
IlluminateSessionSessionServiceProvider::class,
IlluminateTranslationTranslationServiceProvider::class,
IlluminateValidationValidationServiceProvider::class,
IlluminateViewViewServiceProvider::class,
CollectiveHtmlHtmlServiceProvider::class,
/*
* Application Service Providers...
*/
AppProvidersAppServiceProvider::class,
AppProvidersAuthServiceProvider::class,
AppProvidersEventServiceProvider::class,
AppProvidersRouteServiceProvider::class,
/*
* 3rd Party Service Providers...
*/
BarryvdhDebugbarServiceProvider::class,
InterventionImageImageServiceProvider::class,
DavibennunLaravelPushNotificationLaravelPushNotificationServiceProvider::class,
McamaraLaravelLocalizationLaravelLocalizationServiceProvider::class
别名
'App' => IlluminateSupportFacadesApp::class,
'Artisan' => IlluminateSupportFacadesArtisan::class,
'Auth' => IlluminateSupportFacadesAuth::class,
'Blade' => IlluminateSupportFacadesBlade::class,
'Cache' => IlluminateSupportFacadesCache::class,
'Config' => IlluminateSupportFacadesConfig::class,
'Cookie' => IlluminateSupportFacadesCookie::class,
'Crypt' => IlluminateSupportFacadesCrypt::class,
'DB' => IlluminateSupportFacadesDB::class,
'Eloquent' => IlluminateDatabaseEloquentModel::class,
'Event' => IlluminateSupportFacadesEvent::class,
'File' => IlluminateSupportFacadesFile::class,
'Gate' => IlluminateSupportFacadesGate::class,
'Hash' => IlluminateSupportFacadesHash::class,
'Lang' => IlluminateSupportFacadesLang::class,
'Log' => IlluminateSupportFacadesLog::class,
'Mail' => IlluminateSupportFacadesMail::class,
'Password' => IlluminateSupportFacadesPassword::class,
'Queue' => IlluminateSupportFacadesQueue::class,
'Redirect' => IlluminateSupportFacadesRedirect::class,
'Redis' => IlluminateSupportFacadesRedis::class,
'Request' => IlluminateSupportFacadesRequest::class,
'Response' => IlluminateSupportFacadesResponse::class,
'Route' => IlluminateSupportFacadesRoute::class,
'Schema' => IlluminateSupportFacadesSchema::class,
'Session' => IlluminateSupportFacadesSession::class,
'Storage' => IlluminateSupportFacadesStorage::class,
'URL' => IlluminateSupportFacadesURL::class,
'Validator' => IlluminateSupportFacadesValidator::class,
'View' => IlluminateSupportFacadesView::class,
'Form' => CollectiveHtmlFormFacade::class,
'Html' => CollectiveHtmlHtmlFacade::class,
'Debugbar' => BarryvdhDebugbarFacade::class,
'Image' => InterventionImageFacadesImage::class,
'PushNotification' => DavibennunLaravelPushNotificationFacadesPushNotification::class,
'LaravelLocalization' => McamaraLaravelLocalizationFacadesLaravelLocalization::class
我尝试过的事情
Laravel 5.2 服务提供商无法启动
php artisan clear-compiled
composer dump-autoload
php artisan optimize
Laravel - 作曲家找不到服务提供程序类
composer clear
我也烧焦了互联网,但干涸了.. :(https://laracasts.com/discuss/channels/general-discussion/laravel-5-package-serviceprovider-cant-be-found)
想法?
任何想法如何克服非常感谢。现在无法运行该应用程序,并丢失了一天的工作。:/
更新
vendor/composer
中的autoload_files.php
不包含某些框架。 barryvdh/laravel-debugbar
是它的一部分(不会被加载),但例如McamaraLaravelLocalization
不是autoload_files的一部分。
但是McamaraLaravelLocalization
是$prefixesPsr0
下autoload_static.php
的一部分——如果有帮助吗?
autoload_files.php(在/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',
);
溶液
L5的第三次全新安装,我逐个添加SP似乎有效。很高兴回到正轨。不能感谢大家 - 向@MikeBarwick大喊大叫,他们在整个过程中提供了良好的指导 - 谢谢!:)
试试这个:
composer dump-autoload --optimize
这是因为您的提供程序文件中缺少类
$this->app->register(L5SwaggerL5SwaggerServiceProvider::class);
将其粘贴到注册下希望它能开始工作。