Download the PHP package spoova/jwstoken without Composer

On this page you can find all versions of the php package spoova/jwstoken. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jwstoken

JwsToken

This package is used to generate JWS tokens.

Initializing class

Modifying header for generating token

Since a jws token is expected to created, it is essential to define the token header. This can be done by using the method. The header usually contain an header type and a specified algoritm as shown below:

When the method is not defined, the arguments supplied above are assumed to be the default.

Modifying algorithm for generating token only

In the cases where we do not need to defined the entire header, we can modify only the algorithm without setting the full header by using the method. In this case, only the default algo will be modified. For example:

Setting Payload

The JwsToken payload is usually an array data that contains a list of specified data keys that contains relative information about a token that is expected to be hashed. The JwsToken accepts an array under the following specific keys

Obtaining the hashed token

Before a token can be obtained, it must be signed with a secret key using the method after which the token is obtained using the method.

Signing a token is shown below assuming the payload is already defined

When a secret key is signed, a secret key is expected to be defined. By default, the method uses the crypto hashing algorithm , however this can be remodified by supplying a second argument into the method which should be a valid hashing alogithm. Once a payload is signed, we can proceed to obtain the generated token.

Validating a generated token

Once a token is generated, it can be validated using specifically designed methods

Setting a token for validation

In order to test if a token is valid, the method is used. This usually contains the secret key used during token generation and the hashing algorithm used.

Example of testing if a token is valid

Usually, when a token is not valid it can be due to three reasons which is the reason we need to know why a token is not valid using the method. A token may not be valid for the following reasons

Decrypting Token

Valid tokens can be decrypted using the method. Decryption here does not mean that the payload was not visible to users but it is only used to fetch a payload from a valid token. It is impossible to properly detect that any token supplied is a good one but if a token is valid, then we surely know we can obtain a valid payload from it which is done with the method. This method takes the first argument as the token to be decrypted while the second argument is the secret key used to generate the token. Lastly, the third argument is the hash algorithm used to hash the token.

> Decrypting a valid token sample

In the event that a token is checked for validity, the decrypt method can be used immediate to fetch the valid payload


All versions of jwstoken with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package spoova/jwstoken contains the following files

Loading the files please wait ....