Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Latest commit

 

History

History
33 lines (24 loc) · 763 Bytes

integracion-guzzle.md

File metadata and controls

33 lines (24 loc) · 763 Bytes

Crear un consumer con guzzle

Implementación HTTP Factory para Guzzle PSR7

composer require http-interop/http-factory-guzzle

Guzzle HTTP Client Adapter

composer require php-http/guzzle7-adapter

Ejemplo básico de construcción

<?php
declare(strict_types=1);

use Http\Adapter\Guzzle7\Client;
use Http\Factory\Guzzle\RequestFactory;
use Http\Factory\Guzzle\StreamFactory;
use PhpCfdi\SatEstadoCfdi\HttpPsr\HttpConsumerClient;
use PhpCfdi\SatEstadoCfdi\HttpPsr\HttpConsumerFactory;

$streamFactory = new StreamFactory();
$requestFactory = new RequestFactory();
$client = new Client();

$factory = new HttpConsumerFactory($client, $requestFactory, $streamFactory);
$consumer = new HttpConsumerClient($factory);