Re: [RFC][DISCUSSION] Object-oriented curl API v2
| From: | Thomas Bley | Date: | Thu, 26 Jun 2025 19:01:39 +0000 |
| Subject: | Re: [RFC][DISCUSSION] Object-oriented curl API v2 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127763@lists.php.net to get a copy of this message | ||
> Ben Ramsey <ramsey@php.net> hat am 26.06.2025 18:54 CEST geschrieben:
>
>
> On Thu, Jun 26, 2025 at 11:27 Eric Norris <eric.t.norris@gmail.com
> mailto:eric.t.norris@gmail.com> wrote:
>
> > Hello Internals,
> >
> > I'd like to formally propose a restart of the original object-oriented
> > curl API RFC (https://wiki.php.net/rfc/curl-oop):
> >
> > https://wiki.php.net/rfc/curl_oop_v2
> >
> > The prior RFC seemed to get positive feedback, with a small consensus
> > around wanting enum(s) for curl options. I've taken that feedback and
> > incorporated it into a new RFC, as I am not the original author, but I
> > am interested in making another potential improvement to the curl
> > extension.
> >
> > In a nutshell, this version of the RFC:
> >
> > - uses enumerations for curl options and other curl constants
> > - introduces a new Curl namespace
> >
> > I have not yet created an implementation PR. I realize that is
> > somewhat discouraged, but I believe that this should be relatively
> > straightforward to implement (there's also the previous RFC's PR to
> > build on top of). The implementation of this RFC as it is now will
> > likely be tedious, however, so I'd like to get feedback on the
> > enumeration idea before committing to the work.
> >
> > I've outlined one open question in the RFC, which relates to the above:
> >
> > - Should we organize the curl option enumerations by value type? Or
> > have a single enumeration for all curl_setopt options and another for
> > all curl_multi_setopt options?
> >
> > If others (including the original RFC author) are interested in
> > working with me on this, I'm more than open to that, so please let me
> > know.
> >
> > Thanks,
> > Eric
> >
>
>
> IMO, this sounds like something that would be great to start as a userland OOP wrapper for
> cURL, where it can be iterated on and the interface can be tested and changed much quicker. Then,
> maybe proceed to an external extension that can be migrated into core later, once its interface is
> stable.
>
> cURL is massive, and there are a lot of moving parts. I wouldn’t expect to get the API
> correct on the first try. :-)
>
> Cheers,
> Ben
>
see: https://github.com/phpcurl/curlwrapper