Download the PHP package aporat/laravel-auth-signature without Composer

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

Laravel Auth Signature

A robust Laravel package providing a middleware for validating API requests with HMAC-SHA256 signatures. It features configurable signature templates, version-specific authentication settings, and a secure, time-based validation to protect your endpoints.

Packagist Version Packagist Downloads PHP Version Laravel Version GitHub Actions CI Code Coverage


โœจ Features


๐Ÿ“‹ Requirements


๐Ÿš€ Installation

  1. Install the package via Composer:

  2. Publish the configuration file. The service provider is auto-discovered.

    This will create a new configuration file at config/auth-signature.php.


๐Ÿ”ง Configuration

Edit config/auth-signature.php to define your clients, authentication versions, and settings.

Remember to add the corresponding keys to your .env file for security.


๐Ÿ› ๏ธ Usage

Applying the Middleware

Apply the auth.signature middleware to any route or route group that requires signature validation.

The middleware will automatically validate incoming requests and throw a SignatureException (resulting in a 4xx HTTP response) if validation fails.

What the signature covers

The signature is an HMAC-SHA256 over the concatenation (no separator) of the components named by the auth version's signature_template. The signature component is the canonical parameter string, built from the request as follows:

  1. Parameter keys are lowercased.
  2. Keys are sorted as plain strings (so "10" sorts before "9").
  3. Each key/value pair is encoded as rawurlencode(key)=value, and the pairs are joined with &.
  4. Values encode as: null โ†’ empty, true/false โ†’ 1/0, integers verbatim, floats keeping their zero fraction (1.0, not 1), objects as compact JSON with recursively sorted keys, and everything else percent-encoded with rawurlencode.
  5. List values expand to key[0], key[1], โ€ฆ after the sort, in list order โ€” tags[10] therefore follows tags[9], and a[0] precedes a2. Expansion is recursive, and an empty list encodes as key=.

The parameter set is read off the wire: the raw request body (JSON decoded on a JSON request, parse_str on a form-urlencoded one) unioned with the raw query string, with the body winning a key collision.

It is deliberately not $request->input(). Laravel's TrimStrings and ConvertEmptyStringsToNull are global middleware, so they rewrite the parsed bags before any route middleware โ€” including this one โ€” runs. Verifying against those rewritten values means a client that legitimately signs name=Rabi%20 gets checked against name=Rabi, and every request carrying leading or trailing whitespace in a string field is rejected with a mismatch the client cannot see or fix. Reading the raw request leaves both transforms in place for the application behind the middleware.

The query string is included because query parameters are readable through $request->input() regardless of content type, so leaving them out would let anyone append parameters to a captured request without invalidating it. Uploaded files are not signed โ€” their temporary paths differ on every request โ€” so a multipart upload signs only its text fields, which are read from the parsed bag because PHP consumes a multipart body before php://input can be read.

The path component is the percent-decoded path (rawurldecode, which leaves a literal + alone), and bundle_id is taken from the client's configuration verbatim.

Generating a Signature

You can use the SignatureGenerator class to create a valid signature, which is useful for testing or for client-side implementations.

Example Client Request

A client would then make a request including the generated signature and other required headers.


๐Ÿงช Testing

The package is fully tested. To run the test suite:


๐Ÿค Contributing

Contributions are welcome! Please feel free to fork the repository, create a feature branch, and open a pull request.

๐Ÿ“œ License

This package is open-source software licensed under the MIT License.

๐Ÿ’ฌ Support

If you encounter any issues or have questions, please open an issue on the GitHub repository.


All versions of laravel-auth-signature with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
aporat/laravel-filter-var Version ^5.0
illuminate/support Version ^12.0 || ^13.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 aporat/laravel-auth-signature contains the following files

Loading the files please wait ...