定制 pinga/http 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pinga/http

最新稳定版本:v0.1

Composer 安装命令:

composer require pinga/http

包简介

Hypertext Transfer Protocol (HTTP) utilities for PHP

README 文档

README

Hypertext Transfer Protocol (HTTP) utilities for PHP

Requirements

  • PHP 8.1.0+

Installation

  1. Include the library via Composer [?]:

    $ composer require pinga/http
    
  2. Include the Composer autoloader:

    require __DIR__ . '/vendor/autoload.php';

Usage

Response headers

  • Retrieving a header (with optional value prefix)

    $header = \Delight\Http\ResponseHeader::get('Content-Type');
    // or
    $header = \Delight\Http\ResponseHeader::get('Content-Type', 'text/');
  • Setting a header (overwriting other headers with the same name)

    \Delight\Http\ResponseHeader::set('X-Frame-Options', 'sameorigin');
  • Adding a header (preserving other headers with the same name)

    \Delight\Http\ResponseHeader::add('Vary', 'User-Agent');
  • Removing a header (with optional value prefix)

    $success = \Delight\Http\ResponseHeader::remove('X-Powered-By');
    // or
    $success = \Delight\Http\ResponseHeader::remove('X-Powered-By', 'PHP');
  • Retrieving and removing a header at once (with optional value prefix)

    $header = \Delight\Http\ResponseHeader::take('Set-Cookie');
    // or
    $header = \Delight\Http\ResponseHeader::take('Set-Cookie', 'mysession=');

Contributing

All contributions are welcome! If you wish to contribute, please create an issue first so that your feature, problem or question can be discussed.

License

This project is licensed under the terms of the MIT License.

统计信息

  • 总下载量: 522
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-27