Skip to content

Document the most common usage of HTTPlug #227

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

Merged
merged 1 commit into from
Feb 23, 2018

Conversation

greg0ire
Copy link
Contributor

I've seen several people complaining on this section being empty, and
had no idea how to fill it, until today, when I wanted to write a smoke
test for my application and had to figure it out.
Hopefully this will get more people into HTTPlug.

@Nyholm
Copy link
Member

Nyholm commented Feb 23, 2018

Thank you. This is the most common way to use it and it is way better then our "TODO write me" that we have now.

I think it is fine to use discovery and not to instantiate the request factory manually.

$client = HttpClientDiscovery::find();
$messageFactory = MessageFactoryDiscovery::find();
$homeResponse = $client->sendRequest(
$messageFactory->createRequest('GET', 'http://httplug.io')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No TLS :'(

I've seen several people complaining on this section being empty, and
had no idea how to fill it, until today, when I wanted to write a smoke
test for my application and had to figure it out.
Hopefully this will get more people into HTTPlug.
@greg0ire greg0ire changed the title Document the most basic usage of HTTPlug Document the most common usage of HTTPlug Feb 23, 2018
@greg0ire
Copy link
Contributor Author

@Nyholm fixed the commit message

@Nyholm
Copy link
Member

Nyholm commented Feb 23, 2018

Ah, sorry. I was not referring to your words. "most basic" or "most common" does not really matter.

I meant that this is indeed the most common/basic way to use it. It is not the "best practice" or the way one would recommend using it.

Using Discovery is some convenient and I really like it. But one should rather use dependency injection to get the proper request factory or the application user should create an instance of the request factory he/she wants to use.


With that said, I think the PR is perfect as it is. It is just the "tutorial"/intro page.

Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, lets get this in. we should mention DI further down, or add a block here mentioning DI, but its a lot better than nothing. and discovery is fine for the simple demo.

@joelwurtz
Copy link
Member

Thanks, we should do some grep TODO, totally forget this was present

@joelwurtz joelwurtz merged commit e5e4e0c into php-http:master Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants