Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122424 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 qa.php.net (Postfix) with ESMTPS id 474491AFE5A for ; Sun, 18 Feb 2024 10:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1708252075; bh=bHegZAupZyXRAKQq5ODjhGw1IkzMcZyzgMUlz4/v2eU=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Tnkpwy5tgmCir32NGuDbdtQybVBkcew1R43j/Cplp0OcoMJaVjNtt1aU2LJbHu4sI dmMjy7hZkTtboGw2BaqK+o5AZDm1bP02l8fuYbYlIMdyc6XrrwvKM1eLxpS9Na6zry Tf37A9Hqvo3Vg2k2Vz3G9zt8r34YZZchzDWeZtScYk/2i6UQnMPGnDtTw6u12SPKZD K5VOkJvT7/szaoCjpdxSyqfMZkZPC3Wr03+AP1aBkT4jf9ofyyYsh/+1i9JEBa77JO 2YAtZo8sn9l+JB0FfhNsAUG2R42sq3HLAXeItB/WFPD6RrV3gBEDJLwtdSnNLUqgub YnY61iBY2Wahw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AB5CD18106B for ; Sun, 18 Feb 2024 10:27:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) 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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 ; Sun, 18 Feb 2024 02:27:51 -0800 (PST) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-41260f946c8so3305335e9.0 for ; Sun, 18 Feb 2024 02:27:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708252067; x=1708856867; darn=lists.php.net; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=C86IwrJV4FFtEjH8XrTAJD6/1wDPdHwVLTAKbG/PU6E=; b=YedOZpfkuCxycv+ozv3oT/fKKO601LYVLKpoCnWoUVPfd/hnmUx5TEgY5nYfALEwhd i/sY1490SVF2ATdhVDvei1Tu9qPzPhYQSdoCjX4BpfeZiElyXIqbxzWZv7HFB1k51kfS OuSJqxQwr8srYMy1WJzzParc2GP1zlc/ytxJiF/YYnRi2wArkf+vn1ENb3eJmMqtXmJZ r5z4/8gjtodJDTJqUg2dmIdmgtWc7IdqbX5jAUI0QLZ0jfs4Qq6DnZM4aAJgqOGJE84F /5UnOhSpOPdUmqeXAySnmTiitsp4RTyPiNKECJylem61X6sum6E6ffSIYGPWEJ2HTThZ M0rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708252067; x=1708856867; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=C86IwrJV4FFtEjH8XrTAJD6/1wDPdHwVLTAKbG/PU6E=; b=gXJPzLfNBVNncsQ25Jl7m5ij3kP/MVBU9Twd+EgTME5BU7tg76wkuPCcM7NwlVygXJ 4SSYbEJU4OC2YfbxJtUH0WV9NaTgB13uOpSv96CeonPuJcO8s2rIuEDbqQDBw+whdtna EdIbg7gewQN1+qnpr1T8dS6jeQTidg271Ucd4r1UX3PIXI48gUwAOs4RFbh9eQQFQEN1 voHE8KJmoGsr7CGAxDIUyIYO1zzg1nlqzehUCYwY9eptWhZ5ZtcYQ+oyXfDBx/7hHywd gZ1A0Wtpoe5F724lBfoSc2GNdLssQ/hBFs73Zau20d84UOV8Gu1opThMZEki+N5a/nkc 5KLw== X-Gm-Message-State: AOJu0YwKhh6iCglfsMCtK90Nk7fLMsARFzoVjdX47f/2s4hEjGpYHonz i2sKVNbsbCe3lwcdSnY1pFEoQrWzf8K1f9ZwVUZEHIej2BpNHuuDjpu9b0Lm X-Google-Smtp-Source: AGHT+IFOWmXHwtIUHobza8xwwOTbwF88XdMvU2N3yXFmNCW7dx/wb+uxPF9e9JrpMZ3rCNKVPOJr3A== X-Received: by 2002:a05:600c:348b:b0:411:e56c:40ec with SMTP id a11-20020a05600c348b00b00411e56c40ecmr6952574wmq.15.1708252066843; Sun, 18 Feb 2024 02:27:46 -0800 (PST) Received: from [127.0.0.1] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.gmail.com with ESMTPSA id z19-20020a7bc7d3000000b00411e1574f7fsm7633760wmk.44.2024.02.18.02.27.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Feb 2024 02:27:46 -0800 (PST) Date: Sun, 18 Feb 2024 10:27:46 +0000 To: internals@lists.php.net Subject: Re: [PHP-DEV] Re: [RFC] OOP API for cURL extension User-Agent: K-9 Mail for Android In-Reply-To: <9bc2d842-5f56-4062-8b21-3b41310f2c86@app.fastmail.com> References: <9bc2d842-5f56-4062-8b21-3b41310f2c86@app.fastmail.com> Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: rowan.collins@gmail.com (Rowan Tommins) On 17 February 2024 15:57:20 GMT, Larry Garfield = wrote: >The RFC would also benefit greatly from some practical examples of using = the new API=2E Right now it's not clear to me (as someone who almost never= uses Curl directly) how/why I'd use any of these, since there's still "a w= hole crapton of int constants I don't understand floating around=2E" The s= uggestion to use an Enum (or several) here is a good one and would help a l= ot with that, so I'm +1 there=2E To my mind, the *eventual* aim should be that users don't *need* a userlan= d wrapper just to make a simple request in a readable way, and that setting= raw curl options becomes an advanced feature that most users never need=2E I know a lot of people's minds will immediately go to request and response= objects, but I think we can go a long way by just making well-named method= s wrapping one or two curl options each, so that you could write this: $ch =3D new CurlHandle('https://example=2Ecom'); $ch->setMethod('POST'); $ch->setRequestBody('{"stuff":"here"}'); $ch->setBasicAuth('admin', 'correct-horse-battery-staple'); $result =3D $ch->executeAndReturn(); Note that I am not saying every one of those methods needs to be added rig= ht now; adding a few at a time may be sensible to have time to discuss good= names and signatures=2E But to me, renaming CURLOPT_POSTFIELDS to Curl\Str= ingOptionsEnum::POSTFIELDS doesn't get us very far - users shouldn't need a= raw curl setting for such a basic feature in the first place=2E Regards, --=20 Rowan Tommins [IMSoP]