masnathan/curl
最新稳定版本:0.0.2
Composer 安装命令:
composer require masnathan/curl
包简介
Another CURL Object.
关键字:
README 文档
README
#Curl
Another Curl Library...
How to install via Composer
The recommended way to install is through Composer.
# Install Composer $ curl -sS https://getcomposer.org/installer | php # Add curl as a dependency $ php composer.phar require masnathan/curl:dev-master
Once it's installed, you need to require Composer's autoloader:
require 'vendor/autoload.php';
#How to use
##The basic way
$curl = new Curl(); //These are the fast-forward methods $curl->get(string $url [, array $params]); $curl->post(string $url [, array $params]); $curl->put(string $url [, array $params]); $curl->delete(string $url [, array $params]); //or you can do it like a true ninja $response = $curl ->init() ->setOpt(CURLOPT_URL, 'http://somedomain.com/') ->setOpt(CURLOPT_SSL_VERIFYHOST, 0) ->setOpt(CURLOPT_SSL_VERIFYPEER, false) ->setOpt(CURLOPT_CONNECTTIMEOUT, 5) ->setOpt(CURLOPT_RETURNTRANSFER, true) ->execute(); $curl->close(); //or you can login onto a website $curl->init(); $login_page = $curl->login('http://somedomain.com/login', array('username' => 'my_user', 'password' => 'my_fancy_password'), '/path/to/my/cookie.txt'); $private_page = $curl->get('http://somedomain.com/private_page');
##The "not so basic until you know it" way
//These are the fast-forward methods Ch::get( string $url [, array $params [, function $callback [, string $data_type]]]); Ch::post( string $url [, array $params [, function $callback [, string $data_type]]]); Ch::postJson( string $url [, array $params [, function $callback [, string $data_type]]]); Ch::postXml( string $url [, array $params [, function $callback [, string $data_type]]]); Ch::put( string $url [, array $params [, function $callback [, string $data_type]]]); Ch::delete( string $url [, array $params [, function $callback [, string $data_type]]]); //Here are a few examples: Ch::get('http://somedomain.com'); Ch::get('http://somedomain.com', array('param1' => 'some value', 'param2' => 'some other value')); Ch::get('http://somedomain.com', array('param1' => 'some value', 'param2' => 'some other value'), function(data) { var_dump($data); }); Ch::get('http://somedomain.com', array('param1' => 'some value', 'param2' => 'some other value'), function(data) { var_dump($data); }, 'json'); Ch::get('http://somedomain.com', array('param1' => 'some value', 'param2' => 'some other value'), 'json'); Ch::get('http://somedomain.com', 'xml'); Ch::get('http://somedomain.com', function(data) { var_dump($data); }, 'json'); //Any of the above examples is aceptable
License
This library is under the MIT License, see the complete license here
###Is your project using MASNathan\Curl? [Let me know](https://github.com/ReiDuKuduro/Curl/issues/new?title=New%20script%20using%20Curl&body=Name and Description of your script.)!
masnathan/curl 适用场景与选型建议
masnathan/curl 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.68k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2013 年 12 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「curl」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 masnathan/curl 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 masnathan/curl 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 masnathan/curl 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
cURL and cURL based Soap-Client for PHP
Simple cURL wrapper
A fluent PHP CURL wrapper
Build mini web servers in PHP for testing
Async Curl using React\ChildProcess
A Flickr wrapper to allow you to call the Flickr api with Guzzle as the backend.Goal is to have 100% Flickr api coverage rather than just upload/display photos (currently at 23%).
统计信息
- 总下载量: 8.68k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-12-27