【发布时间】:2016-11-08 18:48:10
【问题描述】:
问题
喜欢 L5。但过去 24 小时是一场噩梦。我的第 3 方服务提供商 (SP) 都没有加载。我进行了 L5 的全新安装并尝试添加 SP,但仍然无法正常工作。
当运行composer update 时,SP 会按应有的方式安装在vendor 文件夹中。但是在运行 L5 时,我收到错误消息 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
供应商
/*
* 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
别名
'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
我尝试过的事情
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
我也把互联网烧焦了,但都干了.. :(https://laracasts.com/discuss/channels/general-discussion/laravel-5-package-serviceprovider-cant-be-found)
想法?
任何想法如何克服非常感谢。现在无法运行应用程序并失去了一天的工作..:/
更新
vendor/composer 中的autoload_files.php 不包含某些框架。 barryvdh/laravel-debugbar 是其中的一部分(不会被加载),但例如 Mcamara\LaravelLocalization 不是 autoload_files 的一部分。
但是Mcamara\LaravelLocalization 是$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',
);
解决方案
我在其中一个接一个地添加 SP 的 L5 的第三次全新安装似乎有效。很高兴回到正轨。 非常感谢大家 - 非常感谢 @MikeBarwick,他在整个过程中提供了良好的指导 - 谢谢! :)
【问题讨论】:
-
全新安装和
composer update?这绝对不是一个好的组合。 Composer 更新仅将库安装在您的 composer.lock 文件中。你试过运行composer install吗? -
如果你取出 LaravelLocalization 并保留其他 3 个,它是否有效或转移到另一个类?哪一个?
-
如果你只运行
php artisan,你能看到命令列表吗?尝试使用composer update --no-scripts以防万一,然后再次使用composer update。 -
RahulGovind:试过了。不高兴:/ MarcoAurélioDeleu:试过了。移动到所有其他类(如果我只放入一个失败的类)phaberest:将重新安装并查看是否有效
-
@phaberest php artisan 工作正常。作曲家也更新。直觉告诉我这是一个缓存问题。干净安装。跑
composer install要求我运行composer update。这样做,软件包安装成功。将服务提供商添加到配置中。问题仍然存在 - SP 不加载:/
标签: laravel laravel-5 package composer-php service-provider