Recommendations for a good PHP PHP class

For previous projects, I used

/** * HTTP Class * * This is a wrapper HTTP class that uses either cURL or fsockopen to * harvest resources from web. This can be used with scripts that need * a way to communicate with various APIs who support REST. * * @author Md Emran Hasan < phpfour@gmail.com > * @package HTTP Library * @copyright 2007-2008 Md Emran Hasan * @link http://www.phpfour.com/lib/http * @since Version 0.1 */ 

This works very well, but doesn't seem to have been updated in quite a while (indeed, the link above does not work now ...).

My latest project will actively use http methods (cross-domain access and internal APIs), so I need to make sure that I use the most efficient http / library class possible.

What do you use for this function?

+4
source share
2 answers

PHP has its own HTTP class in PECL :

The HTTP extension simplifies the processing of HTTP URLs, dates, redirects, headers, and messages in the context of HTTP (both inbound and outbound). It also provides tools for matching clients with their preferred language and encoding, as well as a convenient way to exchange arbitrary data with caching and renewal capabilities.

A powerful query and parallel interface (PHP5 +) is also provided if the extension is built with cURL support.

In addition, most PHP functions that can work with remote resources can be used with custom Stream Contexts , which will allow you to customize how PHP connects to resources.

+7
source

I usually use Zend_Http_Client if im doesn't work in a Symfony project - in this case I use sfWebBrowserPlugin .

+3
source

Source: https://habr.com/ru/post/1335112/


All Articles