All Notable changes to bakame/http-strucured-fields will be documented in this file.
Next - TBD
- None
- None
- None
- None
2.0.0 - 2024-12-12
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
Typeinference. - Container
IteratorAggregateinterface always uses theindexas key; it uses to be thekeyfor Ordered Map. append,prependandaddmethods now acceptnullas value which result in doing nothing for consistency.
- None
- 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.
1.3.0 - 2024-01-05
DataType::createreturns anStructuredFieldinstance from aniterableconstruct.DataType::serializereturns the HTTP string representation of a structured field.
InnerList::fromPairshould not throw if the pair is empty because an inner list can be empty.
DataType::builduseDataType::serializeinstead.
- None
1.2.2 - 2024-01-01
- None
Type::ByteSequencevalue is renamed frombytesequencetobinaryto comply with the RFC.
- None
- None
1.2.1 - 2024-01-01
- None
Item::newis fixed to better handle parsing with parameters values.
- None
- None
1.2.0 - 2023-12-30
- Support for the
DisplayStringtype ByteSequence::tryFromEncodedToken::tryFromStringOuterList::fromPairsDataTypeenumType::fromVariableType::tryFromVariableParser::newto simplify parser usage.
- Tests file moved under the
/testsdirectory - Fix
Type::tryFromVariableto correctly detect string type derivative. - the
Typeenum is now a baked string Enum.
Type::fromValueuseType::fromVariableinsteadType::tryFromValueuseType::tryFromVariableinstead
- None
1.1.0 - 2023-05-07
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 from 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
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.
ParameterAccess::withoutParametersreplaced byParameterAccess::withoutParametersBykeys
- None
1.0.1 - 2023-04-20
- None
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
- None
- None
1.0.0 - 2023-04-16
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
- 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.
- None
- [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.
0.8.0 - 2023-03-12
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.
- 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
- None
- [BC Break]
OrderedListis removed, useOuterListinstead. - [BC Break]
ParameterAccess::withoutAllParametersis removed, useParameterAccess::withoutAnyParametersinstead. - [BC Break] remove the
$parametersargument from allItemnamed constructors except fromItem::from. - [BC Break] remove
InnerList::fromList, useInnerList::fromAssociativeParametersorInnerList::fromPairParametersinstead. - [BC Break] remove
OuterList::fromList, useOuterList::frominstead.
0.7.0 - 2023-02-06
- 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.
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.
- None
- [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 removed; useMemberOrderedMap::addandMemberOrderedMap::removeinstead
0.6.0 - 2022-11-12
- 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.
- None.
- None
- [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.
0.5.0 - 2022-05-13
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.
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.
- None
- [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.
0.4.0 - 2022-03-27
Dictionary::mergeAssociativeandDictionary::mergePairsto allow merging with associative structuresParameters::mergeAssociativeandParameters::mergePairsto allow merging with key-value pairs structures
- 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
- None
- [BC Break]
Dictionary::mergereplaced byDictionary::mergeAssociative - [BC Break]
Parameters::mergereplaced byParameters::mergeAssociative
0.3.0 - 2022-03-21
InnerList::fromHttpValuenamed constructor to make the public API consistent for all VOs
- None
- None
- None
0.2.0 - 2022-03-20
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
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.
- None
- [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
0.1.0 - 2022-03-18
Initial release!