All Projects → spatie → Url Signer

spatie / Url Signer

Licence: mit
Create and validate signed URLs with a limited lifetime

Projects that are alternatives of or similar to Url Signer

Laravel Url Signer
Create and validate signed URLs with a limited lifetime
Stars: ✭ 611 (+123.81%)
Mutual labels:  mail, url
Uri
🌏 Functions for making sense out of URIs in PHP
Stars: ✭ 259 (-5.13%)
Mutual labels:  url
ESP-Mail-Client
⚡️Arduino Mail Client Library to send, read and get incoming mail notification for ESP32, ESP8266 and SAMD21 devices. The library also supported other Arduino devices using Clients interfaces e.g. WiFiClient, EthernetClient, and GSMClient.
Stars: ✭ 78 (-71.43%)
Mutual labels:  mail
tall
Promise-based, No-dependency URL unshortner (expander) module for Node.js
Stars: ✭ 56 (-79.49%)
Mutual labels:  url
ProtonClient
An unofficial desktop client for ProtonMail done with electron nativefier
Stars: ✭ 50 (-81.68%)
Mutual labels:  mail
ngx-linkifyjs
Angular V8 wrapper for linkifyjs - library for finding links in plain text and converting them to HTML <a> tags via linkifyjs
Stars: ✭ 40 (-85.35%)
Mutual labels:  url
trym
🔗 A modern URL shortener
Stars: ✭ 29 (-89.38%)
Mutual labels:  url
Ffrouter
Powerful and easy-to-use URL routing library in iOS that supports URL Rewrite(强大、易用、支持 URL Rewrite的 iOS 路由库)
Stars: ✭ 263 (-3.66%)
Mutual labels:  url
Mu4e Dashboard
A dashboard for mu4e (mu for emacs)
Stars: ✭ 259 (-5.13%)
Mutual labels:  mail
Netswift
A type-safe, high-level networking solution for Swift apps
Stars: ✭ 21 (-92.31%)
Mutual labels:  url
requrl
Grab full URL from request.
Stars: ✭ 17 (-93.77%)
Mutual labels:  url
laravel-mjml
Laravel MJML offers support for rendering MJML syntax into in-line HTML that can be sent within mails.
Stars: ✭ 26 (-90.48%)
Mutual labels:  mail
custom-permalinks
Set custom permalinks on a per-post basis in WordPress
Stars: ✭ 17 (-93.77%)
Mutual labels:  url
cpplipa
C++ library package
Stars: ✭ 17 (-93.77%)
Mutual labels:  url
Parse Domain
Splits a hostname into subdomains, domain and (effective) top-level domains.
Stars: ✭ 261 (-4.4%)
Mutual labels:  url
urley
📦 An easy cross-platform utility library to work with URLs in Javascript.
Stars: ✭ 14 (-94.87%)
Mutual labels:  url
node-mbox
mbox file parser for Node.js
Stars: ✭ 64 (-76.56%)
Mutual labels:  mail
imapx
A cross-platform IMAP library for .NET, supporting .Net 2.0 - 4.5, Mono and Windows Phone
Stars: ✭ 28 (-89.74%)
Mutual labels:  mail
Django Multiurl
Have you ever wanted multiple views to match to the same URL? Now you can.
Stars: ✭ 268 (-1.83%)
Mutual labels:  url
Frontexpress
An Express.js-Style router for the front-end
Stars: ✭ 263 (-3.66%)
Mutual labels:  url

Create secured URLs with a limited lifetime

Latest Version on Packagist Software License Build Status Quality Score Total Downloads

This package can create URLs with a limited lifetime. This is done by adding an expiration date and a signature to the URL.

$urlSigner = new MD5UrlSigner('randomkey');

$urlSigner->sign('https://myapp.com', 30);

// => The generated url will be valid for 30 days

This will output an URL that looks like https://myapp.com/?expires=xxxx&signature=xxxx.

Imagine mailing this URL out to the users of your application. When a user clicks on a signed URL your application can validate it with:

$urlSigner->validate('https://myapp.com/?expires=xxxx&signature=xxxx');

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Postcardware

You're free to use this package (it's MIT-licensed), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

All postcards are published on our website.

Installation

The package can installed via Composer:

composer require spatie/url-signer

Usage

A signer-object can sign URLs and validate signed URLs. A secret key is used to generate signatures.

use Spatie\UrlSigner\MD5UrlSigner;

$urlSigner = new MD5UrlSigner('mysecretkey');

Generating URLs

Signed URLs can be generated by providing a regular URL and an expiration date to the sign method.

$expirationDate = (new DateTime)->modify('10 days');

$urlSigner->sign('https://myapp.com', $expirationDate);

// => The generated url will be valid for 10 days

If an integer is provided as expiration date, the url will be valid for that amount of days.

$urlSigner->sign('https://myapp.com', 30);

// => The generated url will be valid for 30 days

Validating URLs

To validate a signed URL, simply call the validate() method. This will return a boolean.

$urlSigner->validate('https://myapp.com/?expires=1439223344&signature=2d42f65bd023362c6b61f7432705d811');

// => true

$urlSigner->validate('https://myapp.com/?expires=1439223344&signature=2d42f65bd0-INVALID-23362c6b61f7432705d811');

// => false

Writing custom signers

This packages provides a signer that uses md5 to generate signature. You can create your own signer by implementing the Spatie\UrlSigner\UrlSigner-interface. If you let your signer extend Spatie\UrlSigner\BaseUrlSigner you'll only need to provide the createSignature-method.

Tests

The tests can be run with:

$ vendor/bin/phpspec run

Integrations

To get started quickly in Laravel you can use the spatie/laravel-url-signer package.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

About Spatie

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].