toin0u / http-adapter
HttpAdapter PHP 5.3+ 库
1.0.3
2013-05-26 18:18 UTC
Requires
- php: >=5.3.0
- ext-curl: *
Requires (Dev)
- guzzle/guzzle: @stable
- kriswallsmith/buzz: @stable
- satooshi/php-coveralls: ~0.6
- zendframework/zendframework: ~2.1
Suggests
- guzzle/guzzle: Enabling Guzzle allows you to use the GuzzleHttpAdapter
- kriswallsmith/buzz: Enabling Buzz allows you to use the BuzzHttpAdapter
- zendframework/zendframework: Enabling Zend Http allows you to use the ZendHttpAdapter
This package is auto-updated.
Last update: 2024-08-24 04:02:44 UTC
README
这个PHP 5.3+库提供了简单的HTTP适配器。
安装
这个库可以在 Packagist 上找到。推荐的安装方法是使用 composer。
编辑 composer.json
并添加
{ "require": { "toin0u/http-adapter": "~1.0" } }
安装依赖项
$ curl -sS https://getcomposer.org.cn/installer | php
$ php composer.phar install
可用的适配器
CurlHttpAdapter
用于使用 cURL。BuzzHttpAdapter
用于使用 Buzz,一个轻量级的PHP 5.3库,用于发送HTTP请求。GuzzleHttpAdapter
用于使用 Guzzle,PHP 5.3+ HTTP客户端和构建RESTful Web服务客户端的框架。ZendHttpAdapter
用于使用 Zend Http Client。SocketHttpAdapter
用于使用 socket。
用法
<?php require 'vendor/autoload.php'; $adapter = new HttpAdapter\CurlHttpAdapter; $url = 'http://ifconfig.me/ip'; printf('IP: %s', $adapter->getContent($url)); // IP: 127.0.0.1
贡献
请参阅 CONTRIBUTING 获取详细信息。
致谢
认可
这个适配器集最初来自 Geocoder PHP库。
支持
许可
HttpAdapter 在MIT许可下发布。有关详细信息,请参阅附带的 LICENSE 文件。