关于php:在通过composer安装barryvdh / laravel-ide-helper时遇到麻烦-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文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
   "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上的项目主页上,它显示:

对于Laravel 4.x,请检查版本1.8

但这似乎是一个无效的链接。

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


好,我有解决方法:(对于Laravel 5,但认为在Laravel 4中也可以使用)

  • 从require数组中删除关于"barryvdh/laravel-ide-helper"的行
    在composer.json文件上。
  • 运行下一行:composer require barryvdh/laravel-ide-helper
  • 您将使用最新版本的barryvdh / laravel-ide-helper扩展更新您的laravel项目

    (更多信息: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->没有匹配的软件包
    找到。


    我找到了,这是我在composer.json

    上需要的行

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

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


    就我而言,

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