gapple / structured-headers
v2.1.2
2024-09-25 08:18 UTC
Requires
- php: ^7.3 || ^8.0
- ext-json: *
Requires (Dev)
- httpwg/structured-field-tests: *@dev
- paragonie/constant_time_encoding: ^2.6.3
- phpstan/phpstan: ^1.9
- phpstan/phpstan-phpunit: ^1.3
- phpunit/phpunit: ^9.5.27
- squizlabs/php_codesniffer: ^3.7.1
This package is auto-updated.
Last update: 2024-09-25 23:29:18 UTC
README
用于HTTP结构化字段值规范的解析器和序列化器。
安装
使用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;