gapple/structured-fields

HTTP结构化字段值的库

v2.1.2 2024-09-25 08:18 UTC

README

HTTP结构化字段值规范的解析器和序列化器。

Build Status codecov

安装

使用composer

composer require gapple/structured-fields

API

Parser类提供静态方法,用于将头部字符串转换为结构化数据。
如果字符串无法解析,将抛出ParseException异常。

Parser::parseItem(string): Item;
Parser::parseList(string): OuterList;
Parser::parseDictionary(string): Dictionary;

Serializer类提供静态方法,用于将结构化数据转换为头部字符串。
如果输入无法序列化,将抛出SerializeException异常。

Serializer::serializeItem(mixed, ?object): string;
Serializer::serializeList(iterable): string;
Serializer::serializeDictionary(object): string;