communitycart/web-tools
Composer 安装命令:
composer require communitycart/web-tools
包简介
A collection of PHP classes used for making and handling web requests.
README 文档
README
A collection of PHP classes used for making web requests, and parsing information related to the HTTP protocol.
Overview
This library contains classes which can be used to perform the following tasks:
- Make GET/POST requests to remote servers.
- Parse raw HTTP headers, and build raw HTTP headers.
- Parse raw HTTP requests.
- Provides a very small web server written in PHP for testing purposes.
Requirements
Installing
The library may be installed using either git or Composer, but I strongly recommend using Composer so dependencies will be automatically installed. Add the web-tools dependency to your composer.json using the following code:
"require": {
"headzoo/web-tools" : "dev-master"
}
Quick Start
<?php use Headzoo\Web\Tools\WebClient; use Headzoo\Web\Tools\HttpMethods; // Make a simple GET request. $web = new WebClient(); $response = $web->get("http://headzoo.io"); // Make a simple POST request. $web = new WebClient(); $response = $web->post("http://headzoo.io", ["arg1" => "value1"]); // The response is an instance of WebResponse, which provides the response information. echo $response->getCode(); echo $response->getBody(); print_r($response->getHeaders()); // Making a requests with more configuration. $web = new WebClient(HttpMethods::GET); $web ->addHeader("Content-Type", "application/json") ->setUserAgent("My-Web-Client") ->setBasicAuth("headzoo", "password"); $response = $web->request("http://headzoo.io");
Class Documentation
This readme only briefly discussing some of the important classes in the library. See the class source code for more information.
Headzoo\Web\Tools\WebClient
Used to make any kind of HTTP request, including GET, POST, PUT, and DELETE.
Headzoo\Web\Tools\WebResponse
Represents a server response from a HTTP request.
Headzoo\Web\Tools\WebServer
A small, not yet finished testing web server.
Headzoo\Web\Tools\WebRequest
Represents an incoming web request.
Headzoo\Web\Tools\Builders\Headers
Normalizes and builds raw HTTP headers.
Headzoo\Web\Tools\Parsers\Headers
Parses raw HTTP headers into an array of key/value pairs.
Headzoo\Web\Tools\Parsers\Request
Parses a raw HTTP request into body, headers, etc.
Headzoo\Web\Tools\HttpMethods
Class of constants representing the supported request methods.
Headzoo\Web\Tools\Utils
Contains various utility methods used through out the library.
Change Log
v0.2 - 2013-12-31
- Major overhaul.
v0.1 - 2013-12-18
- Released code under MIT license.
TODO
- Add cookie management.
- Add certificate management.
License
This content is released under the MIT License. See the included LICENSE for more information.
communitycart/web-tools 适用场景与选型建议
communitycart/web-tools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 01 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「http」 「web」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 communitycart/web-tools 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 communitycart/web-tools 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 communitycart/web-tools 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Model of a web-based resource
Retrieve a WebResourceInterface instance over HTTP
http客户端
Easily add Excepct-CT header to your project
Selectize Theme for Bootstrap 4
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-03