Yii2: Provide HttpClient

Created on 2 Apr 2014  路  22Comments  路  Source: yiisoft/yii2

There is a similar issue of yii (https://github.com/yiisoft/yii/issues/313), not update for one year.

I find a simple wrapper of curl in authclient/BaseOAuth.php, any further plan for a HttpClinet described in that issue ?

feature

Most helpful comment

yii2-httpclient released:
https://github.com/yiisoft/yii2-httpclient

All 22 comments

You can always use Guzzle if you need a curl wrapper.

There are no plans for this from the core team but @DaSourcerer once planned to work on this. Not sure whether he has time for it.

I'm still working on this for Yii 1.1. An adaption for Yii 2 is planned, but I haven't started coding, yet.

@iodragon: I am currently on tour. If you want a detailed status quo, you'll have to wait until I've returned home on either Thursday or Friday.

@DaSourcerer Whether to consider use PHP built-in functions, such as file_get_contents() or other stream wrappers. It can support any kinds of HTTP request by customizing the third parameter.

I think this seems lightweight and efficiently without cURL requires. At least, I hope it can be included as an option.

Draft implementation created at:
https://github.com/klimov-paul/yii2-httpclient

@yiisoft/core-developers, I need someone create a corresponding repository under 'yiisoft', so I can push this code there.
After it is done, we may procced to further disscussion inside it.

@klimov-paul dumb question but... Is PSR-7 compatible? ) async? Cookie support?

Is PSR-7 compatible?

What do you mean?

async?

Only in case of TransportCurl usage.

Cookie support?

Yes, both ways: for the request and for the response.

no

The word "bicycle" used in the English? Because Guzzle is.
It's big work but useless I think.
Guzzle is more featurous, easy using and psr-7 compatible and it's standart de-facto in industry.

There have to be advantages over existing implementations in order to have it in framework. If there are none, it's better to create an interface or document officially about which HTTP client to use.

Thanks, @samdark.

I need 'httpclient' one way or another in order to refactor https://github.com/yiisoft/yii2-authclient to solve multiple issues related to this functionality such as https://github.com/yiisoft/yii2-authclient/issues/27 and https://github.com/yiisoft/yii2-authclient/pull/33

@samdark, it seems I don't have a permsissions for writing the yiisoft/yii2-httpclient. Please check the permissions schema.

@klimov-paul I don't have enough permissions :( @qiangxue need your assistance.

Not sure why, since samdark is an admin. I added the core rev team to this repo anyway.

OK, I have filled up the repository.
Still I have no access to its settings and thus unable to setup any web hook - Travis should be enabled at least.

I'll keep this issue open, since it could be we actually will deny this feature in the end.
Issue can be closed after 'yii2-httpclient' will have the first stable release.

Added travis.

Personally I think that PSR-7 is quite a good writing and could actually be a good guideline for HTTP clients i.e. we can have an interface in the code and implementation in extension like we do for mailer.

Maybe instead of separate extension use HTTPlug in core as client interface and leave the choice of library used on developer?

yii2-httpclient released:
https://github.com/yiisoft/yii2-httpclient

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sobit picture sobit  路  3Comments

Locustv2 picture Locustv2  路  3Comments

sahifedp picture sahifedp  路  3Comments

newscloud picture newscloud  路  3Comments

AstRonin picture AstRonin  路  3Comments