通过composer安装Moltin Cart,然后添加服务提供商:'MoltinCartCartServiceProvider'
,并添加别名'Cart' => 'MoltinCartFacade'
。
现在我得到laravel 4错误:
Symfony Component Debug Exception FatalErrorException Class 'MoltinCartCartServiceProvider' not found.
我已经做了一个自动加载转储来重建我的类映射composer dump-autoload
,但仍然存在问题。
我的composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*",
"intervention/image": "dev-master",
"moltin/cart": "dev-master"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}
我的app.php在这里
<?php
return array(
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => true,
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => 'http://localhost',
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => 'Hb2cd1FUfJV6S0ApZAS9QSAQEFEiusUc',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => array(
'IlluminateFoundationProvidersArtisanServiceProvider',
'IlluminateAuthAuthServiceProvider',
'IlluminateCacheCacheServiceProvider',
'IlluminateSessionCommandsServiceProvider',
'IlluminateFoundationProvidersConsoleSupportServiceProvider',
'IlluminateRoutingControllerServiceProvider',
'IlluminateCookieCookieServiceProvider',
'IlluminateDatabaseDatabaseServiceProvider',
'IlluminateEncryptionEncryptionServiceProvider',
'IlluminateFilesystemFilesystemServiceProvider',
'IlluminateHashingHashServiceProvider',
'IlluminateHtmlHtmlServiceProvider',
'IlluminateLogLogServiceProvider',
'IlluminateMailMailServiceProvider',
'IlluminateDatabaseMigrationServiceProvider',
'IlluminatePaginationPaginationServiceProvider',
'IlluminateQueueQueueServiceProvider',
'IlluminateRedisRedisServiceProvider',
'IlluminateRemoteRemoteServiceProvider',
'IlluminateAuthRemindersReminderServiceProvider',
'IlluminateDatabaseSeedServiceProvider',
'IlluminateSessionSessionServiceProvider',
'IlluminateTranslationTranslationServiceProvider',
'IlluminateValidationValidationServiceProvider',
'IlluminateViewViewServiceProvider',
'IlluminateWorkbenchWorkbenchServiceProvider',
'InterventionImageImageServiceProvider',
'MoltinCartCartServiceProvider'
),
/*
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
|
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
|
*/
'manifest' => storage_path().'/meta',
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => array(
'App' => 'IlluminateSupportFacadesApp',
'Artisan' => 'IlluminateSupportFacadesArtisan',
'Auth' => 'IlluminateSupportFacadesAuth',
'Blade' => 'IlluminateSupportFacadesBlade',
'Cache' => 'IlluminateSupportFacadesCache',
'ClassLoader' => 'IlluminateSupportClassLoader',
'Config' => 'IlluminateSupportFacadesConfig',
'Controller' => 'IlluminateRoutingController',
'Cookie' => 'IlluminateSupportFacadesCookie',
'Crypt' => 'IlluminateSupportFacadesCrypt',
'DB' => 'IlluminateSupportFacadesDB',
'Eloquent' => 'IlluminateDatabaseEloquentModel',
'Event' => 'IlluminateSupportFacadesEvent',
'File' => 'IlluminateSupportFacadesFile',
'Form' => 'IlluminateSupportFacadesForm',
'Hash' => 'IlluminateSupportFacadesHash',
'HTML' => 'IlluminateSupportFacadesHTML',
'Input' => 'IlluminateSupportFacadesInput',
'Lang' => 'IlluminateSupportFacadesLang',
'Log' => 'IlluminateSupportFacadesLog',
'Mail' => 'IlluminateSupportFacadesMail',
'Paginator' => 'IlluminateSupportFacadesPaginator',
'Password' => 'IlluminateSupportFacadesPassword',
'Queue' => 'IlluminateSupportFacadesQueue',
'Redirect' => 'IlluminateSupportFacadesRedirect',
'Redis' => 'IlluminateSupportFacadesRedis',
'Request' => 'IlluminateSupportFacadesRequest',
'Response' => 'IlluminateSupportFacadesResponse',
'Route' => 'IlluminateSupportFacadesRoute',
'Schema' => 'IlluminateSupportFacadesSchema',
'Seeder' => 'IlluminateDatabaseSeeder',
'Session' => 'IlluminateSupportFacadesSession',
'SSH' => 'IlluminateSupportFacadesSSH',
'Str' => 'IlluminateSupportStr',
'URL' => 'IlluminateSupportFacadesURL',
'Validator' => 'IlluminateSupportFacadesValidator',
'View' => 'IlluminateSupportFacadesView',
'Image' => 'InterventionImageFacadesImage',
'Cart' => 'MoltinCartFacade'
),
);
您需要的包不包含类MoltinCartFacade
或MoltinCartCartServiceProvider
。这是因为包"moltin/cart"是一个通用包,不提供任何与Laravel集成的内容。
你要找的包裹名为"moltin/laravel-cart"。
然而,我建议不要使用它。"moltin/cart"主分支的测试目前正在失败,并且没有正式的标记发布。"moltin/lavel cart"的版本控制很尴尬(他们似乎将自己的版本与laravel的目标版本同步),但他们没有注意到laravel明确不遵循语义版本控制,因此像"moltin/ravel car特"那样要求~5.0
将安装一些5.0或5.1版本,这将是不兼容的。