【发布时间】: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