-
Notifications
You must be signed in to change notification settings - Fork 3
Illuminate manager #1
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
Conversation
Thank you for this PR. I think the tests are failing because we miss the ´phpunit.xml.dist`. Btw, does this allow us to have two Guzzle6 clients with different set of plugins? |
Yes, well you could do something like: <?php
// place this in a new serviceprovider or extend HttplugServiceprover
$manager->extend('guzzle6-plugins', function () {
// add custom configuration, plugins etc..
return new \Http\Adapter\Guzzle6\Client();
}); |
Really cool work! Thank you for it. Actually I thought that I had time to work on it, but things are not happen as we will wish 😉 |
@Nyholm can you manage this? I have exactly 0 experience with Laravel. |
BTW thanks for the work on this. |
use GuzzleHttp\Psr7\Request; | ||
|
||
$httplug = app()->make('httplug'); | ||
$request = new Request('GET', 'http://httpbin.org'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the configured factory:
$factory = app()->make('httplug.message_factory.default');
$request = $factory->createRequest('GET', 'http://httpbin.org');
I do not have a lot of experience with Laravel either. That's why @danijeel reached out and offered to help. I've made some comments. Do 👍 or update the readme if they are okey and I'll be happy to merge this PR. Thank you! |
@GrahamCampbell you might also be interested in this |
Thank you again @danijeel |
This is a common approach in Laravel echo system, using the manager class with a facade to handle multiple drivers (clients).
However we could leverage the factory classes used in the symfony bundle to instantiate the clients if we move them to a third package.