Skip to content

Upgrading guzzlehttp/guzzle 2 to 3

Breakingv2.8.8 → v3.8.1Breaking44Deprecated17New81Changed69Fixed79Other30

BreakingUpgrade verdict

44 breaking changes.

  • Sending PHP stream requests no longer forces HTTP/1.0.
  • No longer guessing Content-Type based on the path of a request.
  • Bug fix: Cookies no longer match on IP addresses per RFC 6265.
  • Removed Guzzle\Http\ClientInterface::setDefaultHeaders().
Top 5 of 61 that need code or config changes

PHP requirement changed in v3.7.4: >=5.3.2 → >=5.3.3.

Moves symfony/event-dispatcher 2.1.* → >=2.1. Your build may pick other versions.

Breaking44
Sending PHP stream requests no longer forces HTTP/1.0.
HTTP/1.0
No longer guessing Content-Type based on the path of a request.
Bug fix: Cookies no longer match on IP addresses per RFC 6265.
Removed Guzzle\Http\ClientInterface::setDefaultHeaders().
Removed Guzzle\Http\ClientInterface::getDefaultHeaders().
Removed Guzzle\Http\ClientInterface::expandTemplate().
Guzzle\Http\ClientInterface::expandTemplate()
Removed Guzzle\Http\ClientInterface::setRequestFactory().
Guzzle\Http\ClientInterface::setRequestFactory()
Removed Guzzle\Http\ClientInterface::getCurlMulti().
Guzzle\Http\ClientInterface::getCurlMulti()
Removed Guzzle\Http\Message\RequestInterface::canCache.
Guzzle\Http\Message\RequestInterface::canCache
Removed Guzzle\Http\Message\RequestInterface::setIsRedirect.
Guzzle\Http\Message\RequestInterface::setIsRedirect
Removed Guzzle\Http\Message\RequestInterface::isRedirect.
Guzzle\Http\Message\RequestInterface::isRedirect
CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used.
Removed the whole changedHeader function system of messages because all header changes now go through addHeader.
Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate.
Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti.
Removed Guzzle\Http\Message\Request::receivedRequestHeader and implemented this functionality in Guzzle\Http\Curl\RequestMediator.
Removed the optional $asString parameter from MessageInterface::getHeader.
Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface.
Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders.
Removed Guzzle\Parser\ParserRegister::get.
Removed Guzzle\Parser\ParserRegister::set.
Removed cURL blacklist support.
Removed the injecting of a request object onto a response object.
Bug fix: AsyncPlugin no longer forces HEAD requests.
Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send).
Bug fix: empty parameters are removed from an OAuth signature.
Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream.
Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across response location visitors.
Bug fix: Removed the possibility of creating configuration files with circular dependencies.
BC: Removed Guzzle\Http\Utils class.
Guzzle\Http\Utils
BC: Setting a service description on a client will no longer modify the client's command factories.
BC: Guzzle\Stream\Stream::getWrapper() and Guzzle\Stream\Stream::getSteamType() are no longer converted to lowercase.
Guzzle\Stream\Stream::getWrapper()Guzzle\Stream\Stream::getSteamType()
CurlMulti is no longer reused globally.
URLs with no path no longer contain a "/" by default.
Guzzle\Http\QueryString does no longer manages the leading "?".
BadResponseException no longer includes the full request and response message.
Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value aggregation and no longer uses callbacks.
Service clients no longer require a base_url option in the factory.
Models no longer require a Parameter structure or initial data in the constructor.
Removed support for XML configs and descriptions.
Removed the Validation component and Inspector.
No longer sending Accept and Accept-Encoding headers on every request.
Marked Guzzle\Service\Client::enableMagicMethods() as deprecated.
Guzzle\Service\Client::enableMagicMethods()
Deprecating ZF1 cache and log adapters.
Deprecated17
You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting Guzzle\Common\Version::$emitWarnings to true.
Guzzle\Common\Version::$emitWarnings
Marked Guzzle\Http\Message\Request::isResponseBodyRepeatable() as deprecated.
Guzzle\Http\Message\Request::isResponseBodyRepeatable()$request->getResponseBody()->isRepeatable()
Marked Guzzle\Http\Message\Request::canCache() as deprecated.
Guzzle\Http\Message\Request::canCache()Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()
Marked Guzzle\Http\Message\Request::setIsRedirect() as deprecated.
Guzzle\Http\Message\Request::setIsRedirect()
Marked Guzzle\Http\Message\Request::isRedirect() as deprecated.
Guzzle\Http\Message\Request::isRedirect()
Marked Guzzle\Cache\CacheAdapterFactory::factory() as deprecated.
Guzzle\Cache\CacheAdapterFactory::factory()
Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand.
Marked 'request.params' for Guzzle\Http\Client as deprecated.
Guzzle\Http\Client
Marked Guzzle\Service\Client::getDefaultHeaders() as deprecated.
Guzzle\Service\Client::getDefaultHeaders()
Marked Guzzle\Service\Client::setDefaultHeaders() as deprecated.
Guzzle\Service\Client::setDefaultHeaders()
Marked Guzzle\Parser\Url\UrlParser as deprecated.
Guzzle\Parser\Url\UrlParserparse_url()
Marked Guzzle\Common\Collection::inject() as deprecated.
Guzzle\Common\Collection::inject()
Marked Guzzle\Plugin\CurlAuth\CurlAuthPlugin as deprecated.
Guzzle\Plugin\CurlAuth\CurlAuthPlugin
Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage.
Deprecating Response::getRequest and now using a shallow clone of a request object to remove a circular reference to help with refcount based garbage collection of resources created by sending a…
Deprecating Response::getPreviousResponse() (method signature still exists, but it's deprecated).
Response::getPreviousResponse()
CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated.