Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117974 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10884 invoked from network); 17 Jun 2022 10:29:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2022 10:29:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 20DCD1804BD for ; Fri, 17 Jun 2022 05:17:21 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 17 Jun 2022 05:17:20 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id h36so6639785lfv.9 for ; Fri, 17 Jun 2022 05:17:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xiSFZstzFsDqfJ63M/vZWtDKTRUzLJVv+ZVaDEaNzh4=; b=WW+jujaJhynAnvzlq63Shv1vAN9lB10zCfNCbE6MLEDwh3NbNjLy1/xxGnXm1ZENx0 Jh3Oj4L8K/6SF1SvQZcMsX6T/kvQSccBAyTqXc1B198SS9/8sXcap6YS/t5UDuZ3XEei ve82nckwrANaZiHC/4ufeWoTgw4rQ3sbipdNP2xDcYyhPREbcXo/cgE/vkfCTfSdJbQw 5fkoAXJkmxflC+O3AkyyaxBmklTBHEsrcbds2tS36pQDq2+P3jIE4Xh3aAin9mgN38r4 cB9659O1OZkfJFxZ2aJVl2QxSIjvvcKVHi89Uzi+QwfZGmkuKn/qHF97qRK2SmFYJjvO 2yeA== X-Gm-Message-State: AJIora9Vg3xtmwXm4vvPnS3tMy5i853tfFF/UdL6cVGsD25xwZjiAU3I 0NLOJtLbGcIUkCEoAS4Xw6vR3b6/TrXTu2BXzwDjZ6Rdemar5w== X-Google-Smtp-Source: AGRyM1t5pQWGWoTkcInzSyR/rwMYyaaUM0YY855MxOZzx97iwJdhXfK6x2VzAcGVVuEohO9k7sozQC/CQTsAdYrnS0g= X-Received: by 2002:a05:6512:2395:b0:47f:432a:c643 with SMTP id c21-20020a056512239500b0047f432ac643mr4894773lfv.556.1655468239073; Fri, 17 Jun 2022 05:17:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 17 Jun 2022 08:17:07 -0400 Message-ID: To: Lynn Cc: php internals Content-Type: multipart/alternative; boundary="00000000000053cb2005e1a3bcc3" Subject: Re: [PHP-DEV] Discussion about new Curl URL API and ext/curl improvements From: pierrick@php.net (Pierrick Charron) --00000000000053cb2005e1a3bcc3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Lynn, You have to be careful, even though most developers associate curl with an http client and only use this feature, it's only part of what it is. It's a multiprotocol file transfer library that supports DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. Again I'm not against a new extension that deals nicely with HTTP and has a super nice intuitive OOP API. But for me that's just not the curl extension. That would be a different project like ext/http. Pierrick Le ven. 17 juin 2022, =C3=A0 04 h 27, Lynn a =C3=A9crit = : > Good timezone! > > On Thu, Jun 16, 2022 at 11:44 PM Pierrick Charron > wrote: > >> About making a "Good OOP API", of course the goal is to make a *Good* OO= P >> API. But there are things to take into consideration. The proposal here = is >> yes to expose the new Curl URL API which is quite small, but also to >> modify >> the existing curl API to make it a little bit more digest for developers= . >> Good or bad the existing ext/curl is here and will continue to exist for >> quite some time. It was designed (maybe on purpose or not) to be a low >> level API with tons [1] of low level features, and it was clearly design= ed >> as a thin wrapper/bridge over libcurl. I mean the fact is currently each >> constant is the exact same one as in libcurl, and each function is a >> wrapper over the exact same function in libcurl. Is it OK to have one pa= rt >> that is a thin wrapper and another part that is a "remodeling" of the AP= I >> ? >> (This is not a rhetorical question, I really ask myself the question). >> > > I'm not a C developer, and the only other place I've ever used cURL is on > the command line. I honestly care very little for it resembling whatever > the C library is, as C is a different language with no OOP. The procedura= l > API for cURL is really annoying to deal with, and I think it would be wor= th > designing an OOP counterpart. I think most of this would go into a new > design for setting options among things, as a list of constants with > possible values is one of the worst ways to have to configure something i= n > my opinion. I know that both the Symfony Http Client and Guzzle are popul= ar > libraries, perhaps design wise they could serve as an inspiration? > > I'm personally not too experienced with cURL nor the level of details tha= t > go into http libraries, but I do see this as an opportunity to make a > really good implementation from scratch. In my opinion it's worth spendin= g > some time on this. > > Larry said: > > Like most of the responders so far, I would say skip the procedural API, >> just go OOP and be done with it. >> > > I'm okay implementing one last feature in the procedural API if it's > really desired to have this functionality, especially if this is benefici= al > for security and reduces bugs. The reason being is that even if we have t= he > best possible OOP library for cURL, every single procedural API would > benefit from this change without having to completely rewrite their > implementation, which will be a problem if the OOP interface isn't just a > 1:1 copy into object form. That said, we should avoid having: cURL > procedural + cURL procedural in objects + cURL OOP. Having 2 different > object based libraries to do the same thing PHP is confusing and will jus= t > end up in way too many Stack Overflow questions. > > Perhaps it is best to split this into 2 separate RFCs? > > Regards, > Lynn > --00000000000053cb2005e1a3bcc3--