{"push_id":3167377655,"size":1,"distinct_size":1,"ref":"refs/heads/contracts-http","head":"9dfab1973953f34e615908e187bf52f495a42fe8","before":"eef249ab3f4a67b3e7fb6d8aeb52a4a0d9b943ce","commits":[{"sha":"9dfab1973953f34e615908e187bf52f495a42fe8","author":{"name":"Nicolas Grekas","email":"8d3fadd4fad95f65a95a07af54a8b1c515d4d5e3@gmail.com"},"message":"[HttpClient][Contracts] introduce component and related contracts\n\n| Q             | A\n| ------------- | ---\n| Branch?       | master\n| Bug fix?      | no\n| New feature?  | yes\n| BC breaks?    | no\n| Deprecations? | no\n| Tests pass?   | yes\n| Fixed tickets | -\n| License       | MIT\n| Doc PR        | -\n\nSooner that later, we'll need to send HTTP calls to APIs,\ne.g. Symfony Mailer or #27738 already need it.\n\nCommon existing PHP clients for PHP rely on PSR-7,\nwhich is orthogonal to the way Symfony is designed.\n\nThe reasons we need this in core are the package principles:\nif we want to be able to keep our BC+deprecation promises, we\nhave to build on more stable and more abstract dependencies than\nSymfony itself.\n\nSo here we are. This PR introduces a new `Http` namespace in contracts,\nand a new HttpClient component.\n\nIts surface is by design very simple to use, while still flexible\nenough to cover more advanced use cases thanks to streaming+laziness.\n\n```php\n$client = new NativeHttpClient();\n\n$responseContent = $client->get('https://google.com')->getContent();\n```\n\nBy default, clients follow redirections. When the redirection limit is\nreached, or when a `4xx` or a `5xx` happens, an exception is thrown.\n\nAn array of options can be used when sending requests - see `HttpClientTrait`.\n\nTODO:\n - [ ] validate the design\n - [ ] add tests\n - [ ] split in several PRs?\n\nImplemented:\n - a simple contract for HTTP client\n - fopen()+curl-based clients\n\nNot implemented - help wanted:\n - handle standard proxy-related env vars when using NativeHttpClient;\n   it might be implemented as a decorator.\n - handle redirections \"manually\"; it's required to handle proxy-related\n   env vars properly; it might be implemented as a decorator.\n - a TraceableHttpClient and integration with the profiler\n - FrameworkBundle integration (autowireable alias + semantic configuration if needed)\n - fetch multiple responses concurrently\n - have NativeHttpClient honor socket.bindto set to a local Unix socket","distinct":true,"url":"https://api.github.com/repos/nicolas-grekas/symfony/commits/9dfab1973953f34e615908e187bf52f495a42fe8"}]}
{"actor":{"display_login":"nicolas-grekas"}}