From e77026cdee9462e02dc69f1c3cb3f23d7090b66a Mon Sep 17 00:00:00 2001 From: Ignace Nyamagana Butera Date: Fri, 18 Mar 2022 13:28:26 +0100 Subject: [PATCH] Prepare first release --- CHANGELOG.md | 7 ++++--- README.md | 13 ++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c982d88..01cbfe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ All notable changes to the package will be documented in this file. -## [Next] - TBH +## [0.1.0] - 2022-03-18 -First stable release of `bakame/http-structured-fields` +**Initial release!** -[Next]: https://github.com/bakame-php/http-structured-fields/compare/master...master +[Next]: https://github.com/colinodell/indentation/compare/0.1.0...master +[0.1.0]: https://github.com/colinodell/indentation/releases/tag/0.1.0 diff --git a/README.md b/README.md index b6f2b69..ba0509d 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,10 @@ The package can be used to: ```php use Bakame\Http\StructuredFields\Item; -$fields = Item::from("/terms", ['rel' => "copyright", 'anchor' => '#foo'])); -echo $fields->toHttpValue(); //display "/terms";rel="copyright";anchor="#foo" +$field = Item::from("/terms", ['rel' => "copyright", 'anchor' => '#foo']); +echo $field->toHttpValue(); //display "/terms";rel="copyright";anchor="#foo" +echo $field->value(); //display "/terms" +echo $field->parameter('rel'); //display "copyright" ``` System Requirements @@ -107,6 +109,9 @@ keys are string and the value are bare items. Their public API will be cover in Instantiation via type recognition is done using the `Item::from` named constructor. +- The first argument represents one of the six (6) item type value; +- The second argument, which is optional, MUST be an iterable construct where its index represents the parameter key and its value an item or a item type value; + ```php use Bakame\Http\StructuredFields\Item; @@ -114,11 +119,9 @@ $item = Item::from("hello world", ["a" => 1]); $item->value(); //returns "hello world" $item->isString(); //return true $item->isToken(); //return false -$item->parameter("a")->value(); //returns 1 +$item->parameter("a"); //returns 1 ``` -- The first argument represents one of the six (6) item type value; -- The second argument MUST be an iterable construct where its index represents the parameter key and its value an item or a item type value; Once instantiated, accessing `Item` properties is done via three (3) methods: