Skip to content

Commit

Permalink
Prepare first release
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Mar 18, 2022
1 parent ce13570 commit e77026c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -107,18 +109,19 @@ 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;

$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:

Expand Down

0 comments on commit e77026c

Please sign in to comment.