Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127789 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 9B3101A00BC for ; Mon, 30 Jun 2025 00:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751244320; bh=oa9uXvw+qwuvRmcbBd3y5hn3rqF5dzJyounsGtoo8F4=; h=From:Subject:Date:References:To:In-Reply-To:From; b=eno/FGKQScPyE1GDphAIwdaAns2kXeu7cj/ysN35yvPOS9Nr9QpDfvB6qB+o/TE6q IAAoZmurhYSqQ8EPA11g9bSGYk5uwLwjVMrsjjYgMMItJqI4CXyqNdRtRXVO+GHJ6R h7FBowsbC43c0kl+kPqG4wDsRP38kUXew7OSFXIk/4KL8WNvg1GT29EvYWzIWtbKP9 eb/Llue34bK9XJLgne+Z9OYQ04mM/GvAA5/xWjFxk+Sa9VKxDhtOlw/O8JvwlX3Web 0J+NMTFPGHY/6LsSglxa6tKpDf63NEsMsqV1X/++xknB46Vpnz2Af7LFCbUyujnysb unHla+7MSXdcQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0C47418004E for ; Mon, 30 Jun 2025 00:45:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_50,DMARC_NONE, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 30 Jun 2025 00:45:19 +0000 (UTC) Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-7d3862646eeso96526185a.2 for ; Sun, 29 Jun 2025 17:47:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751244433; x=1751849233; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=I67rPSreO7CYFdDP3qxJ/3ljAL4qkrhIRQ2q7W5uVwM=; b=dptaw59n23KDdflkqBPGJluzo5mLZ6l2MREt42rVyRzNmJTOS/EVF8GGzjht3sQJ2g pByBnfOO0MU95Odg9cTydauwmRGuFwfMv0VegkXcff3nFMoVJirWwF4IymfTxUuR7V37 FWQQCLmRepeQWwsuaKE/Vx8ro+GEdMALsxlfThhzXr85vrSDgE1bTmWGHSwhqPqD/bpc E07DhXEo82YSyzw+CuVywVS0tYLomSnvwj39V0WU+Mfr9wE9VpfefHBLLuuTp+QAohGz +4XIwjjr3SWIjlEqlhsCXq8nbxL8Hbm4iEz/zr1ZKtp0XRC1YDeeKlTjqw365QMyRYWW SjuQ== X-Gm-Message-State: AOJu0YwG5lItn4Nz8NhuNZddKWFKML9i1or2CicRmDDqiMR2FDl1DSiI sHPJyiWYuIzYt4MpOAKk+FMfeMwhLPaXD/lDIT8AboyFkkFoINUXtHwsILoVvKk3Qzr0nM20qjz HULDy77E5B+Y= X-Gm-Gg: ASbGnctJdROqm1kESwahvf2RRhcmvfasjPh461VAcKt7OzIPnhOk9J8awNjZ5aKIWjU 5Sd8oUEkIBce4ggBCfBd5MSP5ibrCJkyTgAWHfI8Q/MRDoAS0SE0H94Z+rTBE+ZxaB2ZSKI8gp+ Yl/ScHMVbu5uULI+1HduigkPDQKaj02DX8aKthxWqwbG09Wb8lOokthxNBS2YNYG76vMfXbKcHa WR+pYosDULGDPpF+bNy5HQOJ+wDeW52t4/WEM/sfpivFuYMj+ymz08gHmJUFTnwnLTkq8fLTVw9 iLPeTt0Z9FyjblDay44tKjhHhlq6tUePdVIQF10wzV2HMSqVTKu/kfR8mP3tqS64IOoX1W+pq+D q5JXt X-Google-Smtp-Source: AGHT+IGKW5xvNJLRCPaMFWT3S8dE4+Z57gAIxHklsGtMjZ2wCF8W/ykYgPZab93eSTPrF8sId0Sm0A== X-Received: by 2002:a05:620a:29c2:b0:7d3:f906:8652 with SMTP id af79cd13be357-7d44397de59mr1462018185a.12.1751244432663; Sun, 29 Jun 2025 17:47:12 -0700 (PDT) Received: from smtpclient.apple ([37.19.211.28]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7d44e13d800sm319568585a.71.2025.06.29.17.47.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Jun 2025 17:47:12 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_6BE8A42D-D57E-42DD-8AE1-95A7F8283D33"; protocol="application/pgp-signature"; micalg=pgp-sha256 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object-oriented curl API v2 Date: Sun, 29 Jun 2025 19:47:00 -0500 References: To: php internals In-Reply-To: Message-ID: <87DC9AA0-52DB-4DA8-A1DC-1940B0051185@php.net> X-Mailer: Apple Mail (2.3826.600.51.1.1) From: ramsey@php.net (Ben Ramsey) --Apple-Mail=_6BE8A42D-D57E-42DD-8AE1-95A7F8283D33 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jun 28, 2025, at 00:01, Larry Garfield = wrote: >=20 > On Fri, Jun 27, 2025, at 4:58 PM, Ayesh Karunaratne wrote: >=20 >> However, I softly oppose this RFC in its current state and the way it >> seems to be going. >=20 > So I think we've identified a key disagreement about not just the = goal, but the intent. To what extent should PHP core ship with a usable = HTTP client? >=20 > Right now it ships with Curl, which... in its current form is not = usable. It's a low-level tool with an inscrutable API we inherited from = C. It's not viable as a user-facing tool. It's a tool that's only = useful to people writing client libraries like Guzzle or CurlClass or = Symfony HTTP or such. >=20 > On the one hand, Marco is correct that for a web-centric language to = not ship with a non-sucky way to send web requests is... kinda = embarrassing. Even if the use cases where you can't install a 3rd party = library are few, they are non-zero. And that also doesn't help new = users figure out what to use. (Eg, the person who wrote most of the = code for our main application at work, learning PHP as he went, is = sending lots of requests using... an ungodly mess of curl that can't = even understand. Because he didn't know that things like Guzzle even = existed.) >=20 > On the other hand, Ben is correct that an HTTP client is a not-small = task, with a very deep rabbit hole. >=20 > So there's two closely related but distinct asks here: >=20 > 1. Make working with curl suck less (giving it an OOP interface is = part of that but not all) > 2. Ship a useful first-party HTTP client that can handle the 80% case, = even if it's not full featured. >=20 > Beefing up Curl's interface until it fulfills part 2 is one approach, = but not the only. >=20 > At one extreme would be the "do nothing, status quo is fine" position. = Ayesh seems to be close to that position, maybe with a little polish = for funsies. The other extreme would essentially be "Guzzle in core," = which I don't think anyone is advocating. Where between those extremes = we should land is debatable. >=20 > Personally I'm of the mind that a simple, basic-features HTTP client = in core would be a good thing; that's central enough that it should not = be left to userland. It doesn't need to offer every possible feature; = no need for async multiplexing, for example. But sending GET and POST = requests with straightforward bodies should be table-stakes for a web = language, and right now, that's a second class citizen. If it's written = in such a way that it can be extended easily in user-space, so much the = better. >=20 > Whether that basic-features client is Curl itself or a bundled wrapper = that uses Curl, I have no strong preference. The challenge of making it = separate from Curl is, shocker, that it's bikeshed bait. Does that = imply using the new URL/URI classes? Does it imply we need = request/response objects? The rabbit hole indeed gets deep fast. >=20 > So the first question, I think, is what is the consensus between these = three coarse-grained positions: >=20 > 1. Status quo is fine. PHP core not having a user-friendly way to send = HTTP requests is acceptable. Maybe make Curl a little nicer, but only to = make life easier for Guzzle et al. > 2. We should develop the Curl API until it's usable for basic HTTP = behavior, but no further. > 3. We should bundle an HTTP client that wraps Curl (with or without = minor improvements to Curl), exact scope TBD. >=20 > Personally, I'm open to either 2 or 3. 3 is more bikesheddable, but = possibly the better end result. >=20 > Where does everyone else stand? >=20 > --Larry Garfield I=E2=80=99m also open to 2 or 3, but 3 sounds more like something that I = think should live in userland, so I lean much more towards 2. Cheers, Ben --Apple-Mail=_6BE8A42D-D57E-42DD-8AE1-95A7F8283D33 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCaGHehAAKCRCwLZeYnIwH G14RAP9hx1pR0S0Kxo2cPudyoiQQFxHRbBplnssEiWnLhECqcwD/a/DSpiDBVD8n 00Kd4nYg9nESm+9UbM+x3VgEnpsVjpQ= =4MDd -----END PGP SIGNATURE----- --Apple-Mail=_6BE8A42D-D57E-42DD-8AE1-95A7F8283D33--