致命错误:Class' Collective \ Html \ HtmlServiceProvider'在使用heroku部署时,在Laravel中找不到

时间:2016-02-24 20:20:37

标签: laravel

这是我的composer.json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",

    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "pusher/pusher-php-server": "~2.0",
        "vinkla/pusher": "^2.2",
        "laravelcollective/html": "^5.2",
        "illuminate/html": "^5.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*",
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "pusher/pusher-php-server": "~2.0",
        "vinkla/pusher": "^2.2",
        "illuminate/html": "^5.0",
        "laravelcollective/html": "^5.2"

    },

    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

问题在于:

[Symfony\Component\Debug\Exception\FatalThrowableError]             
remote:  Fatal error: Class 'Collective\Html\HtmlServiceProvider' not found  
remote:                                                                              
remote:        
remote:  Script php artisan clear-compiled handling the post-install-cmd event returned with an error
remote: 

2 个答案:

答案 0 :(得分:2)

将新提供程序添加到config / app.php的providers数组中:

  'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
  ],

将两个类别名添加到config / app.php的别名数组中:

'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

答案 1 :(得分:0)

首先通过Composer安装此软件包。修改项目的 composer.json 文件,要求 laravelcollective / html

使用此命令

composer require "laravelcollective/html":"^5.4.0"

接下来,将您的新提供商添加到 config / app.php 提供商数组中:

  'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
  ],

将两个类别名添加到 config / app.php 的别名数组中:

  'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

获取更多帮助: - Forms&amp ;;的官方文档可以在LaravelCollective网站上找到Laravel框架的Html。