调用未定义函数 GuzzleHttp\Psr7\get_message_body_summary()

Call to undefined function GuzzleHttp\Psr7\get_message_body_summary()

我正在尝试在 guzzlehttp 中执行 CURL get 请求以检查用户是否存在于 CRM 中。每当我尝试执行请求时,标题中都会出现以下错误,我无法在网上找到任何有关此特定问题的资源。任何想法都会非常有帮助,如果您需要任何其他信息,请在评论中告诉我。

包含的包:

require(__DIR__ . "/../../vendor/autoload.php");
require_once(__DIR__ . "/../../helpers/Validation.php");
use Symfony\Component\Dotenv\Dotenv;
use GuzzleHttp\Client;
use GuzzleHttp\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Psr7;
use GuzzleHttp\Stream\Stream;
use Drupal\Core\Site\Settings;

// Load our environment variables
$dotenv = new Dotenv();
$dotenv->load(__DIR__ . "/../../.env");

private function checkDuplicate() {
  // If no errors we can submit the registrant
  // \Drupal::logger('signup')->notice("access token", print_r($this->_accessToken, TRUE));
  if(!$this->_errors) {
    $checkNewUser = new Client();
    try {
      $options = [
        'headers' => [
        'Content-Type' => 'application/x-www-form-urlencoded',
        'Authorization' => "Bearer " . $this->_accessToken
      ],
      "query" => '$filter=email%20eq%20"' .$this->_email . '"&$fields=Contact Key,First Name,Last Name'
    ];
    $result = $checkNewUser->get($_ENV['REST_API_URL'], $options);
  } catch (RequestException $e) {
    \Drupal::logger('signup')->error("error " . print_r($e->getRequest(), TRUE));
    if ($e->hasResponse()) {
      \Drupal::logger('signup')->error("error " . print_r($e->getRequest(), TRUE));
      echo $e->getRequest() . "\n";
      \Drupal::logger('signup')->error("error " . print_r($e->getResponse(), TRUE));
    }
  }
}

我有一个 post 请求函数来获取可以正常工作的访问令牌。

private function getAccessToken() {
  try {
    $requestAccessToken = new Client();

    $options = [
      'headers' => [
        'Accept'     => 'application/json',
      ],
      "form_params" => [
        "grant_type" => "client_credentials", 
        "client_id" => $_ENV["CLIENT_ID"], 
        "client_secret" => $_ENV["CLIENT_SECRET"]
      ]
    ];
    $result = $requestAccessToken->post($_ENV['CLIENT_API_URL'], $options);

    return (string) $result->getBody();
  }
  catch(Exception $error) {
    \Drupal::logger('signup')->error("error " . $error-getMessage());
  }
}

该问题是由于drupal-8直接支持guzzlehttp,导致与composer安装的包冲突

删除 guzzle 的作曲家库并使用以下文档后: https://www.drupal.org/docs/8/modules/http-client-manager/introduction