diff --git a/README.md b/README.md index 962daa7..041dd1d 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ or a `JWTPlaintextKey` and pass it to the `JWTToken` constructor: $tok->setExpiry("1h"); $tok->claims->add("some/claim/MaxItems", 8); - $str = $tok->getSignedToken(); - +$str = $tok->getSignedToken(); +``` ### Parsing tokens @@ -56,22 +56,23 @@ Parsing is done by passing the raw token as the 2nd parameter use NoccyLabs\SimpleJWT\JWTToken; - $str = "...received token..."; +$str = "...received token..."; $tok = new JWTToken($key, $str); - if (!$tok->isValid()) { - // This check works, but using the validator might be better - } +if (!$tok->isValid()) { + // This check works, but using the validator might be better +} - // Using ->has() follwed by ->get() is one way - if ($tok->claims->has("some/claim/MaxItems")) { - // The claim exists, we can get the value (if any) - $val = $tok->claims->get("some/claim/MaxItems"); - } +// Using ->has() follwed by ->get() is one way +if ($tok->claims->has("some/claim/MaxItems")) { + // The claim exists, we can get the value (if any) + $val = $tok->claims->get("some/claim/MaxItems"); +} - // You can also use valueOf() to return a default value if needed - $val = $tok->claims->valueOf("some/claim/MaxItems", 64); +// You can also use valueOf() to return a default value if needed +$val = $tok->claims->valueOf("some/claim/MaxItems", 64); +``` ### Validating tokens