2014-12-13 51 views
0

我用laravel4.2構建了一個項目; (1)第一,我安裝「edvinaskrucas /通知」 在我composer.json在需要行是這樣的:Laravel4.2 Class'Krucas Notification NotificationServiceProvider'找不到

 "require": { 
    "laravel/framework": "4.2.*", 
    "cartalyst/sentry":"2.1.4", 
    "fzaninotto/faker":"1.5.*@dev", 
    "edvinaskrucas/notification": "4.0.0" 
}, 

(2)第二,我加入兩個碼插入我laravel配置文件這樣最後每線以下的config/app.php:

'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider', 
    'Illuminate\Auth\AuthServiceProvider', 
    'Illuminate\Cache\CacheServiceProvider', 
    'Illuminate\Session\CommandsServiceProvider', 
    'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 
    'Illuminate\Routing\ControllerServiceProvider', 
    'Illuminate\Cookie\CookieServiceProvider', 
    'Illuminate\Database\DatabaseServiceProvider', 
    'Illuminate\Encryption\EncryptionServiceProvider', 
    'Illuminate\Filesystem\FilesystemServiceProvider', 
    'Illuminate\Hashing\HashServiceProvider', 
    'Illuminate\Html\HtmlServiceProvider', 
    'Illuminate\Log\LogServiceProvider', 
    'Illuminate\Mail\MailServiceProvider', 
    'Illuminate\Database\MigrationServiceProvider', 
    'Illuminate\Pagination\PaginationServiceProvider', 
    'Illuminate\Queue\QueueServiceProvider', 
    'Illuminate\Redis\RedisServiceProvider', 
    'Illuminate\Remote\RemoteServiceProvider', 
    'Illuminate\Auth\Reminders\ReminderServiceProvider', 
    'Illuminate\Database\SeedServiceProvider', 
    'Illuminate\Session\SessionServiceProvider', 
    'Illuminate\Translation\TranslationServiceProvider', 
    'Illuminate\Validation\ValidationServiceProvider', 
    'Illuminate\View\ViewServiceProvider', 
    'Illuminate\Workbench\WorkbenchServiceProvider', 
    'Way\Generators\GeneratorsServiceProvider', 
    'Cartalyst\Sentry\SentryServiceProvider', 
    'Krucas\Notification\NotificationServiceProvider' ***--this new join in*** 
), 

'aliases' => array(

    'App'    => 'Illuminate\Support\Facades\App', 
    'Artisan'   => 'Illuminate\Support\Facades\Artisan', 
    'Auth'    => 'Illuminate\Support\Facades\Auth', 
    'Blade'    => 'Illuminate\Support\Facades\Blade', 
    'Cache'    => 'Illuminate\Support\Facades\Cache', 
    'ClassLoader'  => 'Illuminate\Support\ClassLoader', 
    'Config'   => 'Illuminate\Support\Facades\Config', 
    'Controller'  => 'Illuminate\Routing\Controller', 
    'Cookie'   => 'Illuminate\Support\Facades\Cookie', 
    'Crypt'    => 'Illuminate\Support\Facades\Crypt', 
    'DB'    => 'Illuminate\Support\Facades\DB', 
    'Eloquent'   => 'Illuminate\Database\Eloquent\Model', 
    'Event'    => 'Illuminate\Support\Facades\Event', 
    'File'    => 'Illuminate\Support\Facades\File', 
    'Form'    => 'Illuminate\Support\Facades\Form', 
    'Hash'    => 'Illuminate\Support\Facades\Hash', 
    'HTML'    => 'Illuminate\Support\Facades\HTML', 
    'Input'    => 'Illuminate\Support\Facades\Input', 
    'Lang'    => 'Illuminate\Support\Facades\Lang', 
    'Log'    => 'Illuminate\Support\Facades\Log', 
    'Mail'    => 'Illuminate\Support\Facades\Mail', 
    'Paginator'   => 'Illuminate\Support\Facades\Paginator', 
    'Password'   => 'Illuminate\Support\Facades\Password', 
    'Queue'    => 'Illuminate\Support\Facades\Queue', 
    'Redirect'   => 'Illuminate\Support\Facades\Redirect', 
    'Redis'    => 'Illuminate\Support\Facades\Redis', 
    'Request'   => 'Illuminate\Support\Facades\Request', 
    'Response'   => 'Illuminate\Support\Facades\Response', 
    'Route'    => 'Illuminate\Support\Facades\Route', 
    'Schema'   => 'Illuminate\Support\Facades\Schema', 
    'Seeder'   => 'Illuminate\Database\Seeder', 
    'Session'   => 'Illuminate\Support\Facades\Session', 
    'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait', 
    'SSH'    => 'Illuminate\Support\Facades\SSH', 
    'Str'    => 'Illuminate\Support\Str', 
    'URL'    => 'Illuminate\Support\Facades\URL', 
    'Validator'   => 'Illuminate\Support\Facades\Validator', 
    'View'    => 'Illuminate\Support\Facades\View', 
    'Sentry'   => 'Cartalyst\Sentry\Facades\Laravel\Sentry', 
    'Notification'  => 'Krucas\Notification\Facades\Notification' ***-->and this new*** 
), 

(3)當我後刷新火狐「翻鬥自動載入composer.json」,那麼我的問題是:

它說:

Symfony \ Component \ Debug \ Exception \ FatalErrorException(E_ERROR) 未找到類'Krucas \ Notification \ NotificationServiceProvider'!

我該如何解決這個問題?希望看到這個的人能幫助我。

+0

您是否運行'composer update'? – lukasgeiter 2014-12-13 15:29:36

+0

非常感謝你,我有趣的作曲家更新後。它的工作!做得好!令人驚歎! – gitvim 2014-12-13 22:24:54

回答

0

實際安裝你必須將它添加到composer.json後運行composer update包。

composer update將檢測到添加到composer.json的包並下載源代碼。

+0

我只是懷疑「composer update」和「composer dump-autoload」之間有什麼區別? – gitvim 2014-12-14 23:22:55

+0

'composer update'將通過將軟件包下載到供應商文件夾來安裝軟件包。 'composer dump-autoload'重新生成autoload文件。這些文件用於在應用程序運行時加載內存中的所有類。 [這裏是一篇文章](http://www.developed.be/2014/08/29/composer-dump-autoload-laravel/) – lukasgeiter 2014-12-14 23:25:57

0

評論這兩個「連接」,做一個作曲家轉儲自動加載後取消註釋這些行

+0

我明白了。我應該使用「作曲家更新」而不是「作曲家轉儲自動加載」,但我仍然懷疑這兩個命令。 – gitvim 2014-12-14 23:25:13