laravel - fatal error : Class 'Collective\Html\HtmlServiceProvider' not found in Laravel when deploying with heroku

标签 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: 

最佳答案

在 config/app.php 的 providers 数组中添加一个新的提供者:

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

在 config/app.php 的 aliases 数组中添加两个类别名:
'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

关于laravel - fatal error : Class 'Collective\Html\HtmlServiceProvider' not found in Laravel when deploying with heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35612272/

相关文章:

php - Laravel:在 Blade 页面中使用 Assets 方法有什么好处?

php - 如何解决 BadMethodCallException,调用未定义的方法 Illuminate\Database\Query\Builder::filter()

php - 在设置值之前检查请求输入是否不为空

php - 在 Laravel 7 中使用纯文本密码

php - Laravel 5.5 查询生成器其中Raw不返回结果,但原始SQL返回结果

email - Laravel 邮件队列无限循环异常

php - Laravel 5.7 - 将项目转移到实时状态时无法运行 php artisan 命令

php - Laravel 8 文件上传验证失败,任何规则

laravel - 如何在Vuejs中动态管理页面标题?

laravel - 无法在 Laravel API 中启用 CORS?