Skip to content

Releases

v0.8.4

๐Ÿ‘ฎโ€โ™€๏ธ Pass full key in ArrayItem/ArrayItemGetterTransformer

BREAKING CHANGE: if you used $key (low chance) then now you will get full key including the looped item key


v0.8.3

๐ŸŽ‰ Laravel: GetValueFactory->command() wraps command arguments / options for type safe access. docs ๐ŸŽ‰ Laravel: You can extend GetValueFactoryCommand that wraps command arguments / options in GetValue $inputData property you can access within your command. docs


v0.8.2

โ›‘๏ธ Add support for accessing arrays by numeric index in XML ๐Ÿš€ Add support for accessing XML childrens using namespace prefix


v0.8.0

โ›‘ In default strategy ensure that empty string values are converted to null in all value types. ๐Ÿš€ Improve validation exception text with value description: (null), (array with count X), (empty string), string value with maximum of 30 characters.

Breaking changes (small chance):

  • TransformerStrategy renamed to TransformerStrategyContract
  • Empty string values are automatically converted to null.

Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.7.1โ€ฆv0.8.0


v0.6.0

๐Ÿš€ Improved XML support

  • GetterTransformer - Wraps value into GetValue instance (xml or array)
  • getRequiredXMLGetter, getXMLAttributesGetter, getNullableXMLGetter, getXMLGetter, getRequiredXML, getNullableXML methods

๐Ÿ›  Breaking change (minor)

  • ArrayGetterTransformer renamed to GetterTransformer. This class was not documented.

Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.5.1โ€ฆv0.6.0


v0.5.0

๐Ÿš€ Add safe dot annotation for accessing values from child arrays. Documentation ๐Ÿ›  Key contains parent key for exceptions that were thrown from GetValue instances that were created as child instances.

Breaking changes

  • AbstractGetValueException has new required argument in constructor - $key
  • If you are extending GetValue: $key argument accepts string|array instead of string.

Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.4.4โ€ฆv0.5.0


v0.4.0

๐Ÿš€ Add array item transformer that has wrapped array value in GetValue instance. Documentation

$transformer = new ArrayItemGetterTransformer( function (\Wrkflow\GetValue\GetValue $value, string $key): string {
return [
self::KeyValue => $value->getRequiredString(self::KeyValue),
];
});
$values = $getValue->getArray('key', [$transformer]);

๐Ÿ›  $getValue->makeInstance will allow you to create new instance of GetValue with same strategy/builder/actions.

Breaking changes

Critical

  • Renamed ClosureArrayItemsTransformer to ArrayItemTransformer
  • Renamed ClosureArrayTransformer to ArrayTransformer

Minor

  • Transformers transform method has new parameter GetValue $getValue - update your transformers or transform calls.
public function transform(mixed $value, string $key, GetValue $getValue): mixed

v0.3.0

๐Ÿš€ Add ability to transform value before (most transforms) and after validation (mostly your custom transformations).

Breaking change

By my opinion Iโ€™ve implemented default strategy based on my usage on all projects:

  • string -> string is always trimmed and if it is empty then it will be transformed to null
  • bool -> Converts most used representations of boolean in string or number (โ€˜yesโ€™,โ€˜noโ€™,1,0,โ€˜1โ€™,โ€˜0โ€™,โ€˜trueโ€™,โ€˜falseโ€™) and converts it to bool.

Also, if you are not using named arguments you need to update:

GetValue::__construct

  • new argument $transformerStrategy. This will be mostly used for tweaking.
  • $getValidatedValueAction was moved as last argument. Probably will not be used.
  • $exceptionBuilderย - was moved before $getValidatedValueAction
public function __construct(
public readonly AbstractData $data,
public readonly TransformerStrategy $transformerStrategy = new DefaultTransformerStrategy(),
public readonly ExceptionBuilderContract $exceptionBuilder = new ExceptionBuilder(),
GetValidatedValueAction $getValidatedValueAction = null,
);

v0.2.1

โ›‘ Made getArrayGetter match getArray (returns always array instance) and add getNullableArrayGetter to return null if data is missing or empty.

Breaking change

๐Ÿ›  getArrayGetter does not return null any more. Use getNullableArrayGetter instead to get null if data is missing.


v0.2.0

๐Ÿš€ Add ability to get validated value (use rules: [] in methods). Documentation.

โ›‘ int|string|float|bool|string is now validated and throws \Wrkflow\GetValue\Exceptions\ValidationFailedException.

Breaking change

๐Ÿ›  If you are extending exception builder then you need to implement new method

/**
* @param class-string<RuleContract> $ruleClassName
*/
public function validationFailed(string $key, string $ruleClassName): Exception;

v0.1.0

๐Ÿš€ Initial release