http-php/messages
Composer 安装命令:
composer require http-php/messages
包简介
A simple OOP wrapper to work with HTTP messages in PHP
README 文档
README
This package is to allow you to create HTTP Messages in PHP, in a simple and reliable way.
Installation
composer require http-php/message
Usage
To use this package, it is very simple. Create a message using the following code:
use HttpPHP\Message\Message; $message = Message::make( payload: ['test' => 'payload'], ); // Add a header $message->withHeader( key: 'Authorization', value: 'Bearer some-super-secret-token', ); // Fetch the header value $message->header( key: 'Authorization', )->toString(); // 'Bearer some-super-secret-token' // Fetch all headers $message->headers(); // Fetch the payload $message->payload()->parse(); // Returns an array representation of the payload. $message->payload()->body(); // Returns the raw payload you wish to send.
Testing
To run the test suite:
composer run test
Credits
LICENSE
The MIT LIcense (MIT). Please see License File for more information.
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-26