php-jwt
php-jwt copied to clipboard
feat: Allows Key instance to be used for encoding
Allows an instance of Key to be passed as the second argument to JWT::encode and JWT::sign, making $alg optional.
This is more in line with how decoding works and as such it makes sense to streamline it.
This also generally makes the process easier in the use case where you get an instance of Key injected so you can just encode using JWT::encode($payload, $key) rather than JWT::encode($payload, $key->getKeyMaterial(), $key->getAlgorithm())