通过 composer 安装 barryvdh/laravel-ide-helper 时遇到问题 - class 在 Laravel 4 项目中找不到错误

Having trouble installing barryvdh/laravel-ide-helper via composer - class not found error in Laravel 4 project

我的 Laravel 4.2.x 项目有以下 composer.json 文件:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "laravel/framework": "4.2.*",
        "cartalyst/sentry": "2.1.*",
        "way/generators": "2.*",
        "laracasts/flash": "~1.0",
        "guzzlehttp/guzzle": "~4.0",
        "itsgoingd/clockwork": "1.*",
        "barryvdh/laravel-ide-helper": "~1.11@dev",
        "intervention/image": "dev-master"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php"
        ],
        "files": [
            "app/Latheesan/helpers.php"
        ],
        "psr-0": {
            "Latheesan": "app/"
        }
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan ide-helper:generate",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan ide-helper:generate",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev"
}

直到今天,它一直运行良好。当我 运行 composer update 命令时,出现以下错误:

{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' not found","file":"C:\wamp\www\projectfolder\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php","line":157}}Script php artisan clear-compiled handling the post-update-cmd event returned with an error

看起来导致问题的软件包是 barryvdh/laravel-ide-helper 版本 ~1.11@dev

在 github 上的项目 home page 上,它说:

对于Laravel4.x,check version 1.8

但那似乎是一个死人 link。

那么,对于支持 laravel 4.x 的包,在 composer.json 文件上使用的正确要求行是什么?

我找到了,这是我 composer.json

上需要的行
"barryvdh/laravel-ide-helper": "1.11.*@dev"

它在 packagist.org 网站上被提及:https://packagist.org/packages/barryvdh/laravel-ide-helper

好的,我有解决方案:(对于 Laravel 5,但认为在 Laravel 4 中也可以工作)

  1. 从 require 数组中删除关于 "barryvdh/laravel-ide-helper" 的行 在 composer.json 文件上。
  2. 运行下一行:composer require barryvdh/laravel-ide-helper

您的 laravel 项目将更新为最新版本的 barryvdh/laravel-ide-helper 扩展

(更多信息:https://github.com/barryvdh/laravel-ide-helper


我试过这些行:

  • "barryvdh/laravel-ide-helper": "1.*"
  • "barryvdh/laravel-ide-helper": "1.*@dev"
  • "barryvdh/laravel-ide-helper": "1.11.*@dev"

对于 laravel 5,我在作曲家更新时遇到了下一个错误:

barryvdh/laravel-ide-helper v1.2.1 需要 phpdocumentor/reflection-docblock dev-master#6d705c1a0f9e2a6d73d2e9ec0e538b9dfaf4315f -> 没有匹配的包 找到了。

就我而言,

我的作曲家版本已过时,这就是问题所在。我将我的作曲家更新到最新版本 1.7,问题消失了。