-
-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Symfony] Guzzle to HttpClient #1614
Comments
Replacing automatically Guzzle may be hard/impossible, mostly cause it allows creating middlewares etc. so it's really split along the codebase. Personally I would probably vote for replacing |
That's a challange then :) the point is to automate whan can be automized.
I'm not sure what you mean. Could you share a diff? |
I.e. from: $data = file_get_contents('https://api.github.com/repos/symfony/symfony-docs'); Into: $response = (HttpClient::create())
->request('GET', 'https://api.github.com/repos/symfony/symfony-docs');
$data = $response->getContent(); |
Or i.e. $result = file_get_contents('https://github.com/', false, stream_context_create(['http' => [
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postData,
]])); Into: $result = (HttpClient::create())->request('POST', 'https://github.com/', [
'body' => $postData,
])->getContent(); |
I see. So plain PHP to Symfony/HttpClient? How would the second code would look like with creation of the client? |
Can be exactly same as in first :) |
Does it make sense to create new object per call thought? I don't know how you use it, so I need more examples from you to understand it better |
TBH. I dont really think I have such case currently in code (meaning But for Guzzle, we use it, a lot, but I'm not sure how to help you with example to do some replacement ;) |
Oh, I thought you need it :) |
Closing as too broad, needs specific project |
rectorphp/rector-src@b76243b BinaryOpConditionsCollector: Add tests and fix edge case (#1614)
Ref:
The text was updated successfully, but these errors were encountered: