Download the PHP package salibhdr/typhoon-url-signer without Composer

On this page you can find all versions of the php package salibhdr/typhoon-url-signer. 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 typhoon-url-signer

Typhoon Url Signer

Salibhdr|typhoon

Total Downloads Latest Stable Version Latest Unstable Version License

Introduction

Typhoon Url Signer is a package that signs and validates URLs with ease. You can make secure URLs for your files and any kind of URLs that you want so that no one can access them without permission. You can make URLs with a limited lifetime to make them expire.

You can use this package both standalone and with your Laravel application

Features

Installation

Install with Composer

Getting started

Standalone

You are ready to use the package and no other configuration needed.

Laravel and lumen

Laravel

Register the UrlSignerServiceProvider in your config/app.php configuration file:


Run vendor:publish command:

It will generate the urlSigner.php under config directory.

Copy URL_SIGN_KEY to your env:

Run the urlSigner:generate command to generate a signKey:

It will generate the a sign key in .env file.

Lumen

Register The the UrlSignerServiceProvider In bootstrap/app.php:

Copy the package config file to config directory (you may need to create one):

Copy URL_SIGN_KEY to your env:

Run the urlSigner:generate command to generate a signKey:

It will generate the a sign key in .env file.

Usage

General Description

You have 3 options to sign urls:

1) With Md5 signer 2) With Hmac signer 3) With base signer

All of 3 signers above has implemented form SaliBhdr\UrlSigner\UrlSignerInterface and has 3 methods:

1) create($url,$params) : makes signed url base on input 2) validate($url,$params) : validates signed url throws exception base on input 3) isValid($url,$params) : validates and return true/false instead of exception

All 3 methods sign method take 2 parameters as input.The $url parameter and $params. you can pass only url with query string attach to it:

Or you can pass url and query separately :

So keep this in mind in all 3 methods.

Feel free to make your own signer by implementing UrlSignerInterface.

The url signer default ttl is 7200 seconds (2 hours). Pass null to ttl so that the url's will not expire at all.

Standalone

With Md5 signer

Make instance of Md5UrlSigner:

With HmacUrlSigner signer

Make instance of HmacUrlSigner:

The HmacUrlSigner gets algorithm through second parameter. Default hashing algorithm is sha256. Pass second parameter if you want to pass another algorithm other than sha256. You can see list of all available algorithms here

With base UrlSigner signer

The url signer ecosystem is working based on 3 main class:

1) the signer : is the hash method class 2) the signature : is the main class that signs the url based on the signer 3) the urlSigner : is the class that uses the signature to make and validate urls

So by the description above you must define all 3 to make the base url signer work. This way you are free to use any signer and signature to make urls as long as implement SignerInterface for the signer and SignatureInterface for the signature.

First make a signer

You can use one of 3 signers built in this package. 1) SaliBhdr\UrlSigner\Signers\Md5 2) SaliBhdr\UrlSigner\Signers\Hmac 3) SaliBhdr\UrlSigner\Signers\Rsa

Second make a signature and path the signer:

Third and final step make UrlSigner and path the signature:


Now you can use the url signer:

Creating signed url:

Validate signed url:

The validate() method will throw one these 2 errors: 1) SignatureMissingException : If the url has no sg parameter in it 2) SignatureNotValidException : If the sg parameter is not a valid one 3) SignatureTimestampMissingException : If the url has no ts parameter in it 4) SignatureUrlExpiredException : If the link is expired

Note 1: If you want to handle exceptions, All exceptions are extended from UrlSignerException Note 2: The Url expiration and missing timestamp exception are throw when you define a ttl (time to live)

Laravel


Notice: Please read Standalone section above for read the details about methods.

The url signer default ttl is 7200 seconds (2 hours). Set null to ttl in config so that the url's will not expire at all.

You can use UrlSigner facade to sign and validate urls.

Or you can pass url and query separately :

To validate url's :

Todos

Issues

You can report issues in github repository here

License

Typhoon-Url-Signer is released under the MIT License.

Built with ❤ for you.

Free Software, Hell Yeah!

Contributing

Contributions, useful comments, and feedback are most welcome!


All versions of typhoon-url-signer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
phpseclib/phpseclib Version ~2.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 salibhdr/typhoon-url-signer contains the following files

Loading the files please wait ....