PHPackages                             basekit/signed-url - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. basekit/signed-url

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

basekit/signed-url
==================

Generate secure URLs with an expiration

1.0.1(4y ago)246.4k↓40.7%MITPHPPHP ~7.3 || ~8.0

Since Aug 7Pushed 4y ago2 watchersCompare

[ Source](https://github.com/basekit/signed-url)[ Packagist](https://packagist.org/packages/basekit/signed-url)[ Docs](https://github.com/basekit/signed-url)[ RSS](/packages/basekit-signed-url/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (7)Used By (0)

Generate signed URL with an optional expiration date
====================================================

[](#generate-signed-url-with-an-optional-expiration-date)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c5f86dd8997a88d89d413ceb1f12b87bdf0eaa7c6b019ce09b2e8d2bfcb26bd5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626173656b69742f7369676e65642d75726c2e737667)](https://packagist.org/packages/basekit/signed-url)[![GitHub Tests Action Status](https://github.com/basekit/signed-url/workflows/Tests/badge.svg)](https://github.com/basekit/signed-url/workflows/Tests/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/7a5ef1fbd37a97081a95d37051cc0bb27faf911b27a14e0147efd2bfb9f9ff33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626173656b69742f7369676e65642d75726c2e737667)](https://packagist.org/packages/basekit/signed-url)

Introduction
------------

[](#introduction)

This package is for simple generation and validation of signed URLs.

What is a signed URL?

> A signed URL is a URL that provides limited permission and time to make a request. Signed URLs contain authentication information in their query string, allowing users without credentials to perform specific actions on a resource [source](https://cloud.google.com/storage/docs/access-control/signed-urls)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require basekit/signed-url
```

Usage
-----

[](#usage)

### Create a signed URL with an expiration

[](#create-a-signed-url-with-an-expiration)

```
$urlSigner = new BaseKit\SignedUrl('secret');
$url = $urlSigner->sign('http://dev.app', new \DateTime("+ 10 days"));
echo $url;
// http://dev.app?expires=1597606297&signature=2bcbe00d36010bae3e6bc6e6abe79f6cbc135f360285eeb17e9c53753b4b223a"
```

### Create a signed URL without expiration

[](#create-a-signed-url-without-expiration)

```
$urlSigner = new BaseKit\SignedUrl('secret');
$url = $urlSigner->sign('http://dev.app');
echo $url;
// http://dev.app?expires=1597606297&signature=2bcbe00d36010bae3e6bc6e6abe79f6cbc135f360285eeb17e9c53753b4b223a"
```

### Validate a signed URL

[](#validate-a-signed-url)

```
$url = "http://dev.app?expires=1597606297&signature=2bcbe00d36010bae3e6bc6e6abe79f6cbc135f360285eeb17e9c53753b4b223a";
$urlSignValidator = new BaseKit\SignedUrl('secret');
$valid = $urlSignValidator->validate($url);
var_dump($valid);
// bool(true)
```

The package will append 1 or 2 querystring parameters to the URL that represent the expiry of the link (when provided), and the signature. The signature itself is generated using the original url, the expiry date if provided, and a project specific secret.

It's possible to override the names of these querystring parameters in object instantiation, as below:

```
$urlSigner = new BaseKit\SignedUrl('secret', 'expirationParam', 'secureSignature');
$url = $urlSigner->sign('http://dev.app', new \DateTime("+ 10 days"));
echo $url;
// https://www.dev.app/?expirationParam=1597608096&secureSignature=ef6839ad6b1a4cfca8e3e04bb2a74da0e9d3d9c4d9870125f499f75c9ef5d2b6
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Rob Mills](https://github.com/robjmills)
- [BaseKit](https://github.com/basekit)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~201 days

Total

4

Last Release

1505d ago

Major Versions

0.2.0 → 1.0.02022-04-04

PHP version history (2 changes)0.1.0PHP ~7.3

1.0.0PHP ~7.3 || ~8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/110251?v=4)[Rob Mills](/maintainers/robjmills)[@robjmills](https://github.com/robjmills)

![](https://avatars.githubusercontent.com/u/9568499?v=4)[markjeffries](/maintainers/markjeffries)[@markjeffries](https://github.com/markjeffries)

---

Top Contributors

[![robjmills](https://avatars.githubusercontent.com/u/110251?v=4)](https://github.com/robjmills "robjmills (6 commits)")[![joel-maizonnier](https://avatars.githubusercontent.com/u/97093492?v=4)](https://github.com/joel-maizonnier "joel-maizonnier (1 commits)")

---

Tags

signed-urlbasekit

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/basekit-signed-url/health.svg)

```
[![Health](https://phpackages.com/badges/basekit-signed-url/health.svg)](https://phpackages.com/packages/basekit-signed-url)
```

###  Alternatives

[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[league/uri-components

URI components manipulation library

31932.3M67](/packages/league-uri-components)[scssphp/scssphp

scssphp is a compiler for SCSS written in PHP.

62827.7M220](/packages/scssphp-scssphp)[fivefilters/readability.php

A PHP port of Readability.js

311826.8k5](/packages/fivefilters-readabilityphp)[bezhansalleh/filament-panel-switch

Easily Switch between your Filament Panels

159323.5k2](/packages/bezhansalleh-filament-panel-switch)[jane-php/json-schema-runtime

Jane runtime Library

1811.1M13](/packages/jane-php-json-schema-runtime)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
