Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127837 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 A08281A00BC for ; Wed, 2 Jul 2025 15:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751471235; bh=MbwTNTW+XzqHWtfXCUZEf4JY0Lz45cIHbDQAgMsvBjo=; h=References:In-Reply-To:Reply-To:From:Date:Subject:To:Cc:From; b=h3Kf7b0EY5kkeOg7QGvJHz0bYY4BbiyXwom+XbP667QRgXEjBpbSKk5A89jtqt+73 BT0I8sWzdvMw4xzQ4L4Mee3TYbz6JHS9AGXGYlXvBybHOCvG/Sns2bqb5aNlgCqcKX HQz/X9DyL3vtwgqytQR97DUHt9KKKozZasqTOnVJkQua0Ce/2syozsjVhOglk3LDUe Titd6/L5wUpcJ7IIgWLg/dW5vu8W1xKZ+kNtVCFoX+u/fJjzYE4aIVaJQJoictEA/H aRvkB7uIB4tVcXpwVBmbtwfVb8CR7mAr8NC5g1Oanm1cPQltsAOpUCwTnBI6uJqDRP HGEQvxxB9YVAQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D72C0180034 for ; Wed, 2 Jul 2025 15:47:14 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, FREEMAIL_REPLYTO,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-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.178]) (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 ; Wed, 2 Jul 2025 15:47:14 +0000 (UTC) Received: by mail-il1-f178.google.com with SMTP id e9e14a558f8ab-3dc9e7d10bdso14637615ab.2 for ; Wed, 02 Jul 2025 08:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751471346; x=1752076146; darn=lists.php.net; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MbwTNTW+XzqHWtfXCUZEf4JY0Lz45cIHbDQAgMsvBjo=; b=QbXv14+BprSIc2FpHL8JjjrxgUKswUqRy9Mo7J69vO2XC/unYv9A6+kMhgXG1Sh4xn sjJf4amDDAzoEu71Ihwf4t3vPJvtpZxMbYdBLwOy11PUEbizqc/M4XdUPkl3f0ZxNGSD D2eBTc/Ku1VQmN/CFTqkGoZ5X6c3pGSMhwY01ZbOm84T2BatsWTu9YH8fdDUdW9kpB7v zH4iP3k8pjBiVnM/Tqxmtg9iNRZeCQO3ZSXc+BUS9xWi/yiuKaZkK0glc7vq0lAGfHGa 3wcHVk1vezbzpN0Lb6qFmWwIBEo2xcZrV3FIl/Z+zkNXTdUOu5zq56oWNfcMEwiFzNb4 SzEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751471346; x=1752076146; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MbwTNTW+XzqHWtfXCUZEf4JY0Lz45cIHbDQAgMsvBjo=; b=Yha59CH3hw5bZuzkD7atQvQNrR1Wk18MoO7TT9baEA4sYE2OJVLKaduGBjErSA9UBp JPCofifvT3r0Aan7Fkmn/ldj5L9kSektyx3vCMmozgPw/mPmVqQeACblX115wWEL/CQ9 zOHs6A+7iXTANUxPjCjtilioYrwcGnYRWfDmeIGit+TBpkhhkNTRK3sHTA7LKAi5oZUe V/ulky3LH1HO0It9VeneDCS9NRva4f8/4sSP9miY11KXc66o2P0o/CvToKnVWSLu/xWY XYiJgnnStOgUSz4aceb8ZpaLMM1Lx1w5nuBiI6Ot+wY6On60ppdGBOUt5x9a1yDZYwY4 Fwzg== X-Gm-Message-State: AOJu0YywFlVojK+cb8xWdOebmto/UFxKjmC/5TcCSvhv2odcUqrH8RfS ByNufjqaiL/9JoA6wy64ngMzOZHWMF/04ukhE15XeVH6DMS0FgQiPrFSMpEI7jHi1bJKH7tR65x CkekN8gotfxhb3Be5xJ8d1jtuVN0eA3kFcg5b X-Gm-Gg: ASbGncsx0EV1vTWnvupmKfvQzl0rlBFmgSKc00iFGVK/xVpmB2aWJfgGJ/Cx8rg/ZqZ u+KvRLcNtm3Hwnug5EYLtljEd1m1826mKsnW6nh2SKb5BdSvyswV2uOtj0UA8tYdWUNcb33zz8L MXtVDf0HbLxg2LLLiYPUqlCOjE1Bjh2wVC6mb2tddkcCSJey+Fv3AhQEiNd6SpwlEDXMKhK7z5a bLNRA== X-Google-Smtp-Source: AGHT+IHTJzwTdgps14c/4fyAy0rGnNEvwPp4aImPsbOKBXDqJ/f/XNCNm6104ul17QkQynPePGVW8+/C7f6OJmKag14= X-Received: by 2002:a05:6e02:12cd:b0:3df:5309:e97f with SMTP id e9e14a558f8ab-3e05c345d03mr491385ab.22.1751471345560; Wed, 02 Jul 2025 08:49:05 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Reply-To: erictnorris@gmail.com Date: Wed, 2 Jul 2025 11:48:49 -0400 X-Gm-Features: Ac12FXzoTHIQ-OEjblZeA7wpcU8XcE5tv-lt9yVuzFkra3PQcXHVqcILQccJUQU Message-ID: Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object-oriented curl API v2 To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" From: eric.t.norris@gmail.com (Eric Norris) > Based on the feedback so far (I do plan on waiting for more responses > to your email), and on my own preferences, I wonder if there is a > hybrid option I could propose. Perhaps the RFC could offer both a > \Curl\Handle (tentative name) to address position 1, and a > \Curl\BasicHttpHandle (also tentative name) that addresses position 2? > If people were amenable, I'd even make the BasicHttpHandle a separate > vote. > > I agree that 3 is both more bikesheddable and also possibly ideal, but > I feel my above suggestion maybe strikes the right balance between the > "status quo is fine, I don't want to see random HTTP-related methods > on my low(est)-level curl object" and the "I'd like to do basic HTTP > stuff with curl, without a library" crowds. > > Barring that, my preference would be 2, but I'd accept 1 just to have > it pass - like I mentioned elsewhere, I think there is value in > introducing namespaces and object-oriented APIs for "modernization" > and language consistency reasons. Having thought about this some more, while I'm still feeling somewhat positive about my suggestion I'm just not sure it's the best way to proceed. I started to sketch what a BasicHttpHandle class would look like, and I'm stuck on how to get data about the response out of the class. Naively, we could have $response_status_code and $response_headers properties, and have the same fetch() and execute() methods I suggested elsewhere to get the response body. Alternatively, we could return a simple CurlHttpResponse object which contains all three properties in the fetch() and execute() implementations for the BasicHttpHandle class. Both of these are fine, but they would lock us out of being PSR7 compatible. I think that people would probably desire PSR7 compatibility, and I would feel uncomfortable with eliminating or tainting the possibility of achieving this. For example, if we had this BasicHttpHandle and then later introduced PSR7 response objects, we'd need to either break backwards compatibility for the class, or introduce a second class. We could also go straight to returning a PSR7 compatible response for the BasicHttpHandle class, but I think that likely deserves its own RFC. So in closing, if people felt generally okay with the limitation of not being PSR7 compatible, I'd probably still add some form of my BasicHttpHandle suggestion as a secondary vote. If people thought PSR7 was necessary, I'd drop it, and leave a PSR7-in-core RFC for the future. In that case, I'd go with Larry's option 1 for the RFC; I've currently updated the RFC to match that option for now.