Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127780 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 D706D1A00BC for ; Sat, 28 Jun 2025 05:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751086818; bh=lNN4wxSZgeQaQNyf2/P+h1OxX54xFvcwnpJGMRts+O0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=brV4a2uPvOhaNCHzmBxzWbQb9rGqDkpBRyLjfkCeZM4pTgl8CLviCPNNlfMP0zovZ crc7DmIZOf7tTPL+6GnAIc0EgvO9r3HeQz7prrC4/A0Mfpa+/VtFw3rDYXWxKX3U7m UCPjUydyBR0fuVmb6HRjXqnib9WlfrFGjanmC11im3C51ha/wHxTXxVuMAq3gw6uGo YZUCXZ7k+Fu1s6H/1fl0gjtBOgEgpmbE+I/Q9wVqVkgth6uP3x/QOuB0QDJL+Ec/sr o0LWXzEGLlfJqOMp+Jwtx8ndrQe4QHl+D+rJUDCOHe1cMQLm6kLWxLgV5GRWfmTTyc uaXYu7E5gVmtQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 52FAA1801D6 for ; Sat, 28 Jun 2025 05:00:17 +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=-0.9 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE 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 fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) (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 ; Sat, 28 Jun 2025 05:00:17 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id B6495EC024A for ; Sat, 28 Jun 2025 01:02:10 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Sat, 28 Jun 2025 01:02:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1751086930; x=1751173330; bh=I5U37IA86WZgtFUJ2reaE SJFnm9Yu/9ldS9KDtnAVDg=; b=PUbYIPR6/WygYHjj394ELH+TSSLgmPlzIMBHb UiBhnEfSevNtWHKBKtVPtAc5EzN13zsdR40HUIfCh3Oux5D+TNrfRDXXKLvYKaO2 eBIOm3ZMR632/QhWMbYcS4lVOXg3ovzoW/u815QsfTmrIYo3vD88INhUb4PmUSdY BqsE6yLGObFw8OXFCunhoB39wZdOtFUckdpvixKziUqrsaWgeTsJ4rxhrhu8o3pC PfM63ilbd+8t4X3mmRfQSBooVsND+TWmGeHGscyJ97EJ76RRLWKXlza6ZJqx3X3I 7zClji9rfvtxQ54xBiHgg2zeX4ac2D2c7xT03tzf2B3vMvnfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1751086930; x=1751173330; bh=I 5U37IA86WZgtFUJ2reaESJFnm9Yu/9ldS9KDtnAVDg=; b=hC2lHGnYZ4vzJ4n0T STAoCfEN0fBiqUkXrT+jdiZUW3Bcma3gd6mNVgyOF91xhqg5vWUt3TGmt2HmlL/N y7ENNeE0O6udLJeXQBvHoho5L11Oyo1TSqCCCQ9345zIXaR+hbPhVRGYd85SxhuY T9YVrQVuLac8ay+lCjRIkMex21FzYvP6LmgcQDtXUqBSOZhVSDeh/CNF9zQhR96B yHUWaps0xEDgh0ITpdsEe4o/vkir3JjEz+T4pYZl4HUlbNWP0iFVc65Af9AYvwdQ FV2vMGqNlnpZZ/eN9YNiEvXmOikpTd10gq+2kIHIhdtlq2q8s5wCm5Rk9oW7XftP UPOpQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdehtdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh epofggfffhvffkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfnrghrrhihucfi rghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqeenuc ggtffrrghtthgvrhhnpeegffdvlefhledtgfelheffgfefgeevudekgeehgeeujeejvdeg hefffffhhfektdenucffohhmrghinhephhhtthhptghlihgvnhhtihhsrghnohhtqdhsmh grlhhlthgrshhkfihithhhrghvvghrhiguvggvphhrrggssghithhhohhlvgdrshhonecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhi esghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprd hnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 3860D700068; Sat, 28 Jun 2025 01:02:10 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T6541924c602fb011 Date: Sat, 28 Jun 2025 00:01:32 -0500 To: "php internals" Message-ID: In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object-oriented curl API v2 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Fri, Jun 27, 2025, at 4:58 PM, Ayesh Karunaratne wrote: > However, I softly oppose this RFC in its current state and the way it > seems to be going. 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? 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. 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.) On the other hand, Ben is correct that an HTTP client is a not-small task, with a very deep rabbit hole. So there's two closely related but distinct asks here: 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. Beefing up Curl's interface until it fulfills part 2 is one approach, but not the only. 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. 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. 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. So the first question, I think, is what is the consensus between these three coarse-grained positions: 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. Personally, I'm open to either 2 or 3. 3 is more bikesheddable, but possibly the better end result. Where does everyone else stand? --Larry Garfield