shopexpress/request-response
Composer 安装命令:
composer require shopexpress/request-response
包简介
ShopExpress Request - Response
README 文档
README
Request instantiation
$request = new \ShopExpress\RequestResponse\Request\Request('http://example.com/');
Retrieve single input from the query string
$request->query('test', 0);
Retrieve all query string data
$request->query();
Retrieve single input from request payload
$request->request('test', 0);
Retrieve all request payload data
$request->request();
Request method
$request->getMethod();
Retrieve an input item from the request
The input method retrieves values from entire request payload (including the query string). For the case of GET, HEAD request methods, request body isn't being considered.
$request->input('test', 0);
Determining if an input value is present
If you would like to determine if a value is present on the request and is not empty, you may use the filled method. For the case of GET, HEAD request methods, request body isn't being considered.
$request->filled('test');
Response
Response instantiation
$response = new \ShopExpress\RequestResponse\Response\Response(
Request $request,
200,
['Content-Type' => 'text/html; charset=utf-8'],
'OK'
);
Set response body
$response->setBody('test');
Retrieve header value
$response->getHeader('Content-Type');
Add or replace header value
If you would like to add header value, pass true in the last argument
$response->withHeader('Access-Control-Allow-Methods', 'PUT', true);
$response->withHeader('Access-Control-Allow-Origin', '*');
统计信息
- 总下载量: 3.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-24