Download the PHP package mydaniel/laravel-paseto without Composer

On this page you can find all versions of the php package mydaniel/laravel-paseto. 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 laravel-paseto

Laravel Paseto

Latest Version on Packagist Total Downloads License

This package provides a PASETO (Platform-Agnostic Security Tokens) authentication guard for Laravel. It offers a modern, secure, and easy-to-use alternative to JWT (JSON Web Tokens).

Paseto tokens are encrypted and authenticated, providing better security guarantees than JWT out of the box.

Features

Installation

You can install the package via composer:

Configuration

  1. Publish the configuration file:

    This will create a config/paseto.php file in your project. You can customize token expiration, issuer, audience, and other claims here.

  2. Generate a Secret Key:

    Run the following artisan command to generate a secure, 32-byte hex-encoded key. The command will automatically add it to your .env file.

    This will add a line like this to your .env file:

  3. Configure the Auth Guard:

    Open your config/auth.php file and make the following changes:

Usage

1. Preparing Your User Model

Add the MyDaniel\Paseto\Contracts\PasetoSubject contract and the MyDaniel\Paseto\Traits\HasPaseto trait to your User model.

The PasetoSubject contract ensures your model has the necessary methods for generating token claims. The HasPaseto trait provides a ready-to-use implementation for these methods.

2. Generating a Token

After authenticating a user (e.g., in a login controller), you can generate a token for them.

3. Protecting Routes

Use the auth:api middleware in your routes/api.php file to protect routes that require authentication.

Clients should send the token in the Authorization header as a Bearer token:

4. Logging Out (Invalidating a Token)

To invalidate a token, you can use the logout method from the Auth facade. This will add the token's unique identifier (jti) to the blacklist for its remaining lifetime.

Note: The blacklist feature requires a cache driver. By default, it uses your application's default cache driver. You can specify a different cache store in config/paseto.php.

Customizing Token Claims

You can add custom claims to your tokens by implementing the getJwtCustomClaims method in your User model.

Contributing

Contributions are welcome! Please feel free to submit a pull request on GitHub.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-paseto with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3|^8.4
illuminate/auth Version ^9.0|^10.0|^11.0|^12.0
illuminate/contracts Version ^9.0|^10.0|^11.0|^12.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
paragonie/paseto Version ^v3.0
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 mydaniel/laravel-paseto contains the following files

Loading the files please wait ...