Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teodoroleckie/url-signer
⚡ Create secured URLs with a limited lifetime in php
https://github.com/teodoroleckie/url-signer
php-8 safe-uri safe-url safety security uri-check url-signer
Last synced: 3 days ago
JSON representation
⚡ Create secured URLs with a limited lifetime in php
- Host: GitHub
- URL: https://github.com/teodoroleckie/url-signer
- Owner: teodoroleckie
- License: mit
- Created: 2021-04-26T07:55:11.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-11T07:27:13.000Z (over 3 years ago)
- Last Synced: 2024-05-02T04:13:12.612Z (5 months ago)
- Topics: php-8, safe-uri, safe-url, safety, security, uri-check, url-signer
- Language: PHP
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# url-signer
Create secured URLs with a limited lifetime in php
[![Latest Version on Packagist](https://img.shields.io/packagist/v/tleckie/url-signer.svg?style=flat-square)](https://packagist.org/packages/tleckie/url-signer)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/teodoroleckie/url-signer/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/teodoroleckie/url-signer/?branch=main)
[![Total Downloads](https://img.shields.io/packagist/dt/tleckie/url-signer.svg?style=flat-square)](https://packagist.org/packages/tleckie/url-signer)
[![Code Intelligence Status](https://scrutinizer-ci.com/g/teodoroleckie/url-signer/badges/code-intelligence.svg?b=main)](https://scrutinizer-ci.com/code-intelligence)
[![Build Status](https://scrutinizer-ci.com/g/teodoroleckie/url-signer/badges/build.png?b=main)](https://scrutinizer-ci.com/g/teodoroleckie/url-signer/build-status/main)## Installation
You can install the package via composer:
```bash
composer require tleckie/url-signer
```## Usage
```php
sign('https://www.domain.com/path/?query=value');
// https://www.domain.com/path/?query=value&ttl=1619446592&signature=b42cb0868c6c46aad10d2a5f6e3c6503cd6b9668try{
$signer->validate($signed);
}catch(ExpiredUriException $exception){
// handle expired uri}catch(UnsignedException $exception){
// Decrypt failed
}// sign without expiration
$signer = new Signer('password', 'signature');
$signed = $signer->sign('https://www.domain.com/path/?query=value');
// https://www.domain.com/path/?query=value&signature=e39fe2feea843712dc2b3fa069a50c6965594f5b```