Release Notes
These are the release notes from bakame/http-structured-fields. We’ve tried to cover all changes,
including backward compatible breaks from the first commit through to the current stable release.
If we’ve missed anything, feel free to create an issue, or send a pull request.
version 2.0.0 - 2024-12-12
Added
Bytesclass replace theByteSequenceclass.Ietfenum.- methods
fromRFC9651,fromRfc8941,toRFC9651,toRfc8941, to ease parsing/serializing Structured Fields. - method
equals, to allow comparison of Structured Fields DataType. - method
whento allow conditional addition to Structured Field DataType. - methods
map,reduce,filter,sortto all containers classes. - methods
isEmpty,isNotEmptyto all containers classes. - methods
getByIndex,hasIndices,indicesto all containers classes. - methods
getByKey,hasKeys,indexByKey,keyByIndex,toAssociativeto all ordered map classes (DictionaryandParameters). StructuredFieldProviderinterfaceItem::parameterByKeyandItem::parameterByIndexmethods to mirror the new public API.- All
Itemnamed constructors have atryequivalent which returnnullinstead of throwing an exception Parameters::valueByKeyParameters::valueByIndex- Added a validation mechanism to facilitate
ItemandParametersvalidation against field definition. Dictionary::mergeParametersByPairs,Dictionary::mergeParametersByAssociativeParameters::mergeParametersByPairs,Parameters::mergeParametersByAssociative
Fixed
- Fixed
Typeinference. - Container
IteratorAggregateinterface always uses theindexas key; it uses to be thekeyfor Ordered Map.
Deprecated
- None
Removed
- Removed the
Parserfrom the public API. MemberContainer,MemberList,MemberOrderedMap, and all the Parser related methods.- All deprecated methods during the version 1 cycle.
Item::parameterreplaced byItem::parameterByKeyParameters:getreplaced byParameters::getByKeyParameters:pairreplaced byParameters::getByIndexDictionary:getreplaced byDictionary::getByKeyDictionary:pairreplaced byDictionary::getByIndexOuterList:removereplaced byOuterList:removeByIndicesInnerList:removereplaced byInnerList:removeByIndices::hasNoMemberand::hasMembersmethods have been replaced byisEmptyandisNotEmptyon containersDictionary::toPairsandParameters::toPairsByteSequenceclass replaced byBytesclassDataType::createmethod use a specific DataType class instead.Valueinternal class.
version 1.3.0 - 2024-01-04
Added
DataType::createreturns anStructuredFieldinstance from aniterableconstruct.DataType::serializereturns the HTTP string representation of a structured field.
Fixed
InnerList::fromPairshould not throw if the pair is empty becuse an inner list can be emoty.
Deprecated
DataType::builduseDataType::serializeinstead.
Removed
- None
version 1.2.2 - 2024-01-02
Added
- None
Fixed
Type::ByteSequencevalue is renamed frombytesequencetobinaryto comply with the RFC.
Deprecated
- None
Removed
- None
version 1.2.1 - 2024-01-01
Added
- None
Fixed
Item::newis fixed to better handle parsing with parameters values.
Deprecated
- None
Removed
- None
version 1.2.0 - 2023-12-30
Added
- Support for the
DisplayStringtype ByteSequence::tryFromEncodedToken::tryFromStringOuterList::fromPairsDataTypeenumType::fromVariableType::tryFromVariableParser::newto simplify parser usage.
Fixed
- Tests file moved under the
/testsdirectory - Fix
Type::tryFromVariableto correctly detect string type derivative. - the
Typeenum is now a baked string Enum.
Deprecated
Type::fromValueuseType::fromVariableinsteadType::tryFromValueuseType::tryFromVariableinstead
Removed
- None
version 1.1.0 - 2023-05-07
Added
OrederedMap::pushOrederedMap::unshiftOrederedMap::insertOrederedMap::replaceOrederedMap::removeByIndicesOrederedMap::removeByKeysParameterAccess::pushParanmetersParameterAccess::unshiftParamatersParameterAccess::insertParamatersParameterAccess::replaceParamaterParameterAccess::withoutParametersByKeysParameterAccess::withoutParametersByIndicesItemParserinterface to return an array representation of a Structured Field as an item.ParametersParserinterface to return an array representation of a Structured Field parameter container.DictionaryParserinterface to return an array representation of a Structured Field dictionary container.ListParserinterface to return an array representation of a Structured Field list container.InnerListParserinterface to return an array representation of a Structured Field inner list container.ValueParserinterface to return a PHP type of a Structured Field Value string representation.Parseris now part of the public APIItem::fromHttpValuenow has an optional second parameter to shift the parser implementation usedParameters::fromHttpValuenow has an optional second parameter to shift the parser implementation usedDictionary::fromHttpValuenow has an optional second parameter to shift the parser implementation usedOuterList::fromHttpValuenow has an optional second parameter to shift the parser implementation usedInnerList::fromHttpValuenow has an optional second parameter to shift the parser implementation used
Fixed
Parameters::removealso removes parameters per indicesType::fromValuethrows anInvalidArgumentexception.Type::fromValueandType::tryFromValueshould only check the PHP variable type and not take into account the variable value.
Deprecated
ParameterAccess::withoutParametersreplaced byParameterAccess::withoutParametersBykeys
Removed
- None
version 1.0.1 - 2023-04-20
Added
- None
Fixed
Parserno longer instantiate anItemobjectParserinternal Date generation simplifiedValuefloat serialization simplifiedOuterList::fromHttpValue,InnerList::fromHttpValue,Dictionnary::fromHttpValuerewritten to improve decoupling fromParser- Adding missing interoperability test for the
Tokentype
Deprecated
- None
Removed
- None
version 1.0.0 - 2023-04-16
Added
InnerList::fromPairto improve InnerList public API;InnerList::toPairto improve InnerList public API;InnerList::fromAssociativeto improve InnerList public API;Itemimplements theValueAccessinterface;Item::toPairto complementItem::fromPair;Item::fromDateto improve and complete the Item Date public API;Item::fromAssociativeto improve Item public API;Item::fromStringto improve Item public API;Token::toStringto return the string representation of the token.Item::new,Parameters::new,Dictionary::new,InnerList::newandOuterList::newto return a new instance
Fixed
- Improve annotation using
@phpstan-type Valueinternal class to improve Item public API;- [BC Break]
::fromAssociativeand::fromPairthe$parametersargument is now required; - [BC Break]
MemberOrderedMapinstances can no longer be added toDictionaryorOuterListinstances. - RFC restriction on eligible container members.
- Exception normalization.
Deprecated
- None
Removed
- [BC Break] Remove
Stringableautomatically converted into a string type. - [BC Break]
InnerList::fromPairParametersuseInnerList::fromPairinstead. - [BC Break]
InnerList::fromAssociativeParametersuseInnerList::fromAssociativeinstead. - [BC Break]
Valueinterface use a combination ofValueAccessandParameterAccessinstead. - [BC Break]
Token::valueis no longer public useToken::toStringinstead. - [BC Break]
Item::fromis removed useItem::fromAssociativeorItem::newinstead. - [BC Break]
Parameters::createis removed useParameters::newinstead. - [BC Break]
InnerList::fromis removed useInnerList::newinstead. - [BC Break]
OuterList::createis removed useOuterList::newinstead.
version 0.8.0 - 2023-03-12
Added
Item::fromTimestamp,Item::fromDateFormat,Item::fromDateStringto improve item instantiation with dates.ParameterAccess::parameterto ease parameter members value access.InnerList::fromAssociativeParameters,InnerList::fromPairParametersto improve item instantiation with parameters.- [BC Break]
ParameterAccess::withoutAllParametersis renamedParameterAccess::withoutAnyParameter. - [BC Break]
OrderedListis renamedOuterList. - [BC Break]
MemberContainer::removemethods get added to the interface. - [BC Break]
MemberContainer::keysmethod added to the interface.
Fixed
- Test suite migrated to PHPUnit 10
- Adding Benchmark test with PHPBench
- Improve Collection immutability with method changes
- [BC Break]
ParameterAccessinterface signature updated to use theValueinterface instead of theItemimplementation. - [BC Break]
MemberList::remove,MemberOrderedMap::removeandMemberOrderedMap::keysmethods are moved to their parent interface. - [BC Break] Renamed arguments for indexation for normalization
- [BC Break]
MemberContainer::hasandMemberOrderedMap::hasPairmethods accept a variadic argument. All submitted indexes/keys should be present for the method to returntrue
Deprecated
- None
Removed
- [BC Break]
OrderedListis removed, useOuterListinstead. - [BC Break]
ParameterAccess::withoutAllParametersis removed, useParameterAccess::withoutAnyParametersinstead. - [BC Break] remove the
$parametersargument from allItemnamed constuctors except fromItem::from. - [BC Break] remove
InnerList::fromList, useInnerList::fromAssociativeParametersorInnerList::fromPairParametersinstead. - [BC Break] remove
OuterList::fromList, useOuterList::frominstead.
version 0.7.0 - 2023-02-06
Added
- Support for
Stringableinstances added toItem::from, the instances will be converted to the string data type. - Support for the upcoming
Datedata type inItemrepresented as aDateTimeImmutableobject. (see https://httpwg.org/http-extensions/draft-ietf-httpbis-sfbis.html) ParameterAccessinterface with new methods to ease parameter members modification.Parameter::createnamed constructor to create a new instance without any parameter.Dictionnary::createnamed constructor to create a new instance without any parameter.TypeEnum of all supported datatype.ValueInterface is introduced withItembeing the only available implementation.MemberOrderedMap::addandMemberOrderedMap::removemethodsByteSequence::equalsandToken::equalsto easily compare type instances.StructuredFieldextends theStringableinterfaceForbiddenOperationexception to reports invalid operation on immutable value objects.
Fixed
Item::fromHttpValuenow internally uses theParserpreviously it was using its own parsing rules.Parameters::fromHttpValuenow internally uses theParserpreviously it was using its own parsing rules.- [BC Break]
::fromAssociative,::fromList,::fromPairsmethods require iterable arguments without default value. - [BC Break]
Item::valuemethod returns the Item (returns value can befloat|int|string|bool|ByteSequence|DateTimeImmutable|Token). - [BC Break]
InnerList::parametersis no longer accessible as a public readonly property. - [BC Break] Modifying container instances with
ArrayAccessmodifying methods is forbidden and will trigger aForbiddenOperationexception.
Deprecated
- None
Removed
- [BC Break]
ForbiddenStateErrorexception is removed; theInvalidArgumentexception is used instead. - [BC Break]
Item::is*methods are removed; the enumTypeis used instead. - [BC Break]
MemberContainer::clearmethod is removed without replacement. - [BC Break]
MemberOrderedMap::setandMemberOrderedMap::deletemethods remonved; useMemberOrderedMap::addandMemberOrderedMap::removeinstead
version 0.6.0 - 2022-11-12
Added
- The
Container,MemberList,MemberOrderedMap,ParameterAccessinterfaces. OrderedListandInnerListimplement theMemberListinterface.ParametersandDictionnaryimplement theMemberOrderedMapinterface.- The
InvalidArgumentexception. Token::valueis a readonly property.Item::valuemethod returns the decoded value of an Item (returns value can befloat|int|string|bool).Item::fromToken,Item::fromDecodedByteSequence,Item::fromEncodedByteSequenceto easeItemcreation.Item::withValueto easeItemvalue update.Parsermethods also acceptsStringableobjects.
Fixed
- None.
Deprecated
- None
Removed
- [BC Break]
__set_stateimplementation in all objects. - [BC Break]
Tokenno longer implements theStructuredFieldinterface. - [BC Break]
Token::toHttpValueis removed; use theItemclass to serialize aToken. - [BC Break]
Token::toStringis removed use its readonly property insteadToken::value. - [BC Break]
ByteSequenceno longer implements theStructuredFieldinterface. - [BC Break]
ByteSequence::toHttpValueis removed; use theItemclass to serialize aByteSequence. - [BC Break]
::sanitizemethod is removed useParameters::clearmethod instead if needed. - [BC Break]
isEmptymethod is removed usehasMembersmethod instead. - [BC Break]
Parameters::valueuseItem::valuemethod instead. - [BC Break]
Parameters::valuesuseParameters::getIteratorinstead. - [BC Break]
Item::valuepublic readonly property useItem::valuemethod instead. - [BC Break]
Item::parameterspublic readonly property useItem::parametersmethod instead. - [BC Break]
InnerList::parameterspublic readonly property useInnerList::parametersmethod instead.
version 0.5.0 - 2022-05-13
Added
Item::fromPairnamed constructor to create a new instance from a pair expressed as an array list with two values.Parameters::sanitizeensure the container always contains only Bare Items.InnerList::sanitizeensure the list is without gaps and callsParameters::sanitize.OrderedList::sanitizeensure the list is without gaps and callsParameters::sanitize.Dictionnary::sanitizeensure the list is without gaps and callsParameters::sanitize.Item::sanitizecallsParameters::sanitize.autoload.phpscript to allow non composer application to load the packageOrderedListandInnerListnow implements the PHPArrayAccessinterface.
Fixed
InnerList::fromHttpValueaccepts Optional White Spaces at the start of its textual representation.Parameters::fromHttpValueaccepts Optional White Spaces at the start of its textual representation.Item::fromHttpValuebugfix parsing Token data type.
Deprecated
- None
Removed
- [BC Break]
InnerListno longer re-index its content replaced byInnerList::sanitizeto force re-indexation. - [BC Break]
OrdererListno longer re-index its content replaced byInnerList::sanitizeto force re-indexation.
version 0.4.0 - 2022-03-28
Added
Dictionary::mergeAssociativeandDictionary::mergePairsto allow merging with associative structuresParameters::mergeAssociativeandParameters::mergePairsto allow merging with key-value pairs structures
Fixed
- All containers
Dictionary,InnerList,OrderedList,Parametersmodifying methods are made chainable. Parseronly returnsarray’s of items or bare items value.- All
Parametersgetters checks for bare items validity. ForbiddenStateErrorextends SPLLogicExceptioninstead ofUnexpectedValueException
Deprecated
- None
Removed
- [BC Break]
Dictionary::mergereplaced byDictionary::mergeAssociative - [BC Break]
Parameters::mergereplaced byParameters::mergeAssociative
version 0.3.0 - 2022-03-21
Added
InnerList::fromHttpValuenamed constructor to make the public API consistent for all VOs
Fixed
- None
Deprecated
- None
Removed
- None
version 0.2.0 - 2022-03-20
Added
Item::valueis a public readonly property that gives access to the item valueItem::parametersis a public readonly property that gives access to the item parametersInnerList::parametersis a public readonly property that gives access to the list parametersOrderedList::fromnamed constructor which accepts a variadic list of members itemsToken::fromStringnamed constructor which acceptsstringandStringableobjectParameter::valuesreturns an array of all the values contained inside theParametersinstance- [BC Break]
ForbiddenStateErrorto replaceSerializationError - [BC Break]
InnerList::fromListto replaceInnerList::fromMembers - [BC Break]
OrderedList::fromListto replaceOrderedList::fromMembers - [BC Break]
Parameter::valueto replaceInnerList::parameterandItem::parameter
Fixed
ByteSequence::fromDecodednamed constructor also accepts aStringableobjectByteSequence::fromEncodednamed constructor also accepts aStringableobjectDictionary::mergeaccepts any iterable that can be accepted byDictionary::fromAssociativeas variadic parameterParameter::mergeaccepts any iterable that can be accepted byParameter::fromAssociativeas variadic parameter- [BC Break]
OrderedList::__constructis made private useOrderedList::frominstead - [BC Break]
InnerList::__constructis made private useInnerList::fromListinstead - [BC Break]
Token::__constructis made private useToken::fromStringinstead - [BC Break]
Parameter::get,Parameter::value,Parameter::pairwill throwForbiddenStateErrorif the BareItem is in invalid state.
Deprecated
- None
Removed
- [BC Break]
InnerList::fromMembersreplaced byInnerList::fromList - [BC Break]
OrderedList::fromMembersreplaced byOrderedList::fromList - [BC Break]
Item::parameterreplaced byParameter::value - [BC Break]
InnerList::parameterreplaced byParameter::value - [BC Break]
SupportsParametersinterface is removed without replacement - [BC Break]
Item::value()replaced byItem::valuepublic readonly property - [BC Break]
Item::parameters()replaced byItem::parameterspublic readonly property - [BC Break]
InnerList::parameters()replaced byInnerList::parameterspublic readonly property - [BC Break]
InnerList::merge()useInnerList::push()orInnerList::unshift()instead - [BC Break]
OrderedList::merge()useOrderedList::push()orOrderedList::unshift()instead - [BC Break]
SerializationErroruseForbiddenStateErrorinstead
version 0.1.0 - 2022-03-18
Initial release!