PHP converted curl's old resources into objects a while ago, but those objects have no methods, so you still call functions like curl_setopt() and curl_exec(). This RFC from Eric Norris would add a real object-oriented curl API. Two earlier attempts at this never reached a vote.
What it adds
- A
Curlnamespace.CurlHandlebecomesCurl\Handle, and so on, with the old names kept as aliases. - Enums for options. Today
curl_setopt()accepts anyint, and it's up to you to pass aCURLOPT_*constant. The RFC adds enums likeCurl\HandleOption,Curl\MultiHandleOption,Curl\InfoandCurl\Pause, so your editor can suggest valid values. - Exceptions instead of
false. Errors throw aCurl\HandleException, following PHP's conventions for extension exceptions. - Two ways to run a request.
fetch()returns the response as a string, andexecute()writes it to a stream or a callback. That's whyCURLOPT_RETURNTRANSFER,CURLOPT_FILEandCURLOPT_WRITEFUNCTIONgo away in the new API.
Curl\MultiHandle covers the curl_multi_* functions, with a few renamed along the way. curl_multi_select() becomes poll(), and curl_multi_info_read() becomes getMessages().
Show me
Here is the RFC's example:
$ch = new Curl\Handle("https://example.com") ->setOption(Curl\HandleOption::ConnectTimeout, 30) ->setOption(Curl\HandleOption::FollowLocation, true); try { echo $ch->fetch() . "\n"; } catch (\Curl\HandleException $ex) { echo "curl error ($ex->code): $ex->message\n"; }
setOption() returns the handle, so you can chain calls. If the request fails, you catch an exception rather than checking for false.
What it means for existing code
The Curl namespace becomes reserved for PHP, so any classes of your own named something like Curl\Handle would clash. The existing curl_* functions and classes like CurlHandle keep working.
A higher-level HTTP client is left for later. The author says there's strong interest in simple GET and POST helpers, but that would need its own RFC.
Where it stands
The RFC is under discussion and targets PHP 8.6. There's no patch yet and no vote has started. The last change listed on the page is from July 7, 2025.
We list it as inactive because the page hasn't changed since July 2025 and no vote was ever held.