Open pfefferle opened 3 years ago
Hey @pfefferle, nice to hear you.
I don't have a lot of experiences on Wordpress but as far as I know, Wordpress has its own HTTP "stack" such as functions like wp_get_http()
, wp_post_http()
etc... and static shortcut methods in the WP_Http
class like WP_Http::get()
, WP_Http::get()
etc...
Do you know if there are some higher level methods that implements PSR 7 / ? The idea behind this is to implement a driver parameter, as it has been made for caching or logging, so that you may configure it on the fly.
I just released a version 0.5.5 with a fromJson() method.
The server part of this library does not listen on any port. It's more intended to be integrated in a controller method. It's a precision because I don't know if this is the blocking aspect in your usage.
Hey @landrok, sorry for the late reply.
I just released a version 0.5.5 with a fromJson() method.
Nice, thanks!
As you said, WordPress has it's own WP_Http
class and mainly uses https://github.com/WordPress/Requests and there is sadly no PSR-7 planned any time soon: https://github.com/WordPress/Requests/issues/320
Nevertheless, do you see a way to remove the hard dependencies of the guzzlehttp/guzzle
, symfony/http-foundation
, symfony/cache
and monolog/monolog
? Maybe to only use the PSR interfaces, so that we will be able to implement them mapping the internal handlers/classes.
If this is not possible (at least in short term), do you think it make sense to "only" use the Activity Objects and keep the server handling we currently use?
Hey @landrok
how likely is it, that the PSR 7 driver feature will make it into the code?
Do you know if there are some higher level methods that implements PSR 7 / ? The idea behind this is to implement a driver parameter, as it has been made for caching or logging, so that you may configure it on the fly.
Are you willing to accept pull requests?
Hey Matthias, First, sorry for the long time since your previous issues. I have played a little bit with WP HTTP features, implemented some anonymous functions to switch between "HTTP driver" (default implementation could be overridden by these anonymous features). I have not published anything because I was not satisfied. Finally I decided to take some time to think about it. And I think you know the following... So, I am still interested in an implementation of PSR 7 as a driver feature but I have not enough time these days to implement it. Of course, I will accept pull requests with pleasure and I would take the time to review them.
I have two more questions if you don't mind:
Guzzle is used as an HTTP client and should be replaced by PSR-18 (ie: https://github.com/landrok/activitypub/blob/master/src/ActivityPhp/Server/Http/Request.php#L42)
HTTP foundation is used as HTTP message and should be replaced by PSR-7 (ie: https://github.com/landrok/activitypub/blob/master/src/ActivityPhp/Server/Http/HttpSignature.php#L66)
Maybe the 2 should be handled as 2 distinct commits, don't you think ?
It could be great. It goes beyond the scope of this "Wordpress compatibility" issue and needs another one that let us discuss about alternatives before implementing.
By the way @Art4 has an open PR to Add PSR-7 support, with an accompanying PSR18-Adapter if anyone is able to test it with this library!
Thanks for mentioning me :+1: Atm the adapter is only supporting Requests v2, but I'm working at support for Requests v1 too.
I would be glad if my library could be helpful.
Update: I released 1.0.0 with support for Requests v1 and v2.
Hey @landrok , I am the author of the WordPress ActivityPub Plugin (https://github.com/pfefferle/wordpress-activitypub) and @mediaformat and I investigated if it is possible to use your lib in the plugin, so I have some questions.
fromJson
method for the Activity Objects, so that we will be able to init the objects, using the JSON request?