【问题标题】:Laravel: Class not found altough composer updateLaravel:通过作曲家更新找不到类
【发布时间】:2018-09-29 12:12:15
【问题描述】:

我正在使用 Laravel 5.5,并且刚刚通过 bash 安装了 Guzzle。我已经这样做了很多次并且知道如何使用 Guzzle,但是这次 Laravel 没有找到 Guzzle 类...

我已经通过 composer update 更新了作曲家,但 Larvel 仍然没有找到我的 Guzzel 类。

如果我通过php composer require guzzlehttp/guzzle 再安装一次 Guzzle 软件包,它总是有效,但只有一次。但是,如果我第二次运行 PHP 脚本,我总是得到Class 'GuzzleHttp\Client' not found。太奇怪了。。

我通过use GuzzleHttp\Client;$this->client = new Client(); 尝试过。同样的错误... 即使我使用$this->client = new \GuzzleHttp\Client();,它也不起作用,我得到同样的错误......

有人知道我为什么会收到此错误...我该如何解决?

更新:

namespace App\Console\Commands;

use GuzzleHttp\Client;
use Illuminate\Console\Command;

class IssueInvoice extends Command
{
    protected $signature = 'radlvoo:issueInvoice';
    private $client_id = "CENSORED";

    public function __construct()
    {
         parent::__construct();
    }

    public function handle()
    {
        $this->client = new \GuzzleHttp\Client();
        $respone = $this->client->request('Get', "https://app.debitoor.com/login/oauth2/authorize?client_id=" . $this->client_id . "&response_type=code&lang=de-de");

        var_dump($respone);
        die();
    }
}

亲切的问候

【问题讨论】:

  • 你得到的完整错误代码是什么。
  • 做一个composer dump-autoload 看看 laravel 是否可以发现这个包,如果不能尝试手动添加它的提供者
  • @AshutoshSharma 这就是我得到的一切......
  • @AH.Pooladvand 我也已经这样做了...同样的错误
  • 我建议您创建一个新问题来解决 ioncube 问题。 “运行 update 以更新它们。”然后运行 ​​composer update

标签: php bash laravel composer-php guzzle


【解决方案1】:

你关于它工作的最后评论,然后不工作让我认为你受到这个 Composer 错误的影响:

https://github.com/composer/composer/issues/7268

如果您使用的是 Composer 1.6.4,可能值得降级到 1.6.3 看看它是否有效。

【讨论】:

    猜你喜欢
    • 2019-10-25
    • 1970-01-01
    • 1970-01-01
    • 2018-05-09
    • 2014-09-07
    • 2016-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多