PHPackages                             kaiquegarcia/lumen-nginx-secure-link - 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. kaiquegarcia/lumen-nginx-secure-link

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

kaiquegarcia/lumen-nginx-secure-link
====================================

Trait to easily adapt a Lumen/Laravel project for using NGINX secure link

v0.1-alpha(5y ago)11MITPHPPHP &gt;=5.6.4

Since Feb 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/kaiquegarcia/lumen-nginx-secure-link)[ Packagist](https://packagist.org/packages/kaiquegarcia/lumen-nginx-secure-link)[ RSS](/packages/kaiquegarcia-lumen-nginx-secure-link/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (2)Dependencies (3)Versions (2)Used By (0)

lumen-nginx-secure-link
=======================

[](#lumen-nginx-secure-link)

Trait to easily adapt a Lumen/Laravel project for using NGINX secure link

Install &amp; Setup
-------------------

[](#install--setup)

Require this package to your Lumen/Laravel project with composer;

### Laravel / Lumen Setup

[](#laravel--lumen-setup)

1. Add `NGINX_SECURE_LINK_SECRET` and `NGINX_SECURE_LINK_TTL` to your `.env` file;
2. Run `php artisan vendor:publish --provider="Nginx\SecureLink\Providers\SecureLinkServiceProvider"`;
3. Run `php artisan config:clear`.

### Nginx Setup

[](#nginx-setup)

You need to create a configuration to each route you want to keep signed. And before making any setup, remember to compile the source or run `apt get install nginx-extras`.

NGINX Configuration (usage example )

```
        location /signed-route/ {
                secure_link $arg_md5,$arg_expires;
                secure_link_md5 "$secure_link_expires$uri$remote_addr NGINX_SECURE_LINK_SECRET";

                if ($secure_link = "") { return 403; }
                if ($secure_link = "0") { return 410; }

        }

```

Explaining those environments
-----------------------------

[](#explaining-those-environments)

1. `NGINX_SECURE_LINK_SECRET` is the "password" you gonna keep in the back-end. You must put it on your environment file AND in each nginx configuration;
2. `NGINX_SECURE_LINK_TTL` is the time in seconds the generated secure\_link will expire.

How to use
----------

[](#how-to-use)

Add to your Eloquent Model a simple `use \Nginx\SecureLink\Traits\WithSecureLink` and you'll be ready, considering the attribute origin's called `link`. For example:

### Model implementation

[](#model-implementation)

```
class ModelExample extends \Illuminate\Database\Eloquent\Model
{
  use \Nginx\SecureLink\Traits\WithSecureLink;
  protected $fillable = ['link'];
}
```

### Usage

[](#usage)

```
$example = new ModelExample();
$secure_link = $example->secure_link;
```

Customizing the origin attribute
--------------------------------

[](#customizing-the-origin-attribute)

You can and should have the possibility to create the secure\_link based on other model attributes. To do this, just override the protected property `$secure_link_origin_attribute`. For example:

### Model implementation

[](#model-implementation-1)

```
class ModelExample extends \Illuminate\Database\Eloquent\Model
{
  use \Nginx\SecureLink\Traits\WithSecureLink;
  protected $fillable = ['my_custom_url'];
  protected $secure_link_origin_attribute = 'my_custom_url';
}
```

Customizing the IP Provider
---------------------------

[](#customizing-the-ip-provider)

As this project were made to Lumen framework, it can have some failures when trying to catch the user Client IP. The reason for that is we're using the class `Illuminate\Http\Request` to reach the `ip` method. If you have any trouble with this, you can develop any class you want to with the same method and override the protected property `$secure_link_ip_class_provider`. For example:

### IP Provider implementation

[](#ip-provider-implementation)

```
class IpProvider extends \Illuminate\Http\Request
{
  public function ip()
  {
    return "the-right-ip";
  }
}
```

### Model implementation

[](#model-implementation-2)

```
class ModelExample extends \Illuminate\Database\Eloquent\Model
{
  use \Nginx\SecureLink\Traits\WithSecureLink;
  protected $fillable = ['link'];
  protected $secure_link_ip_class_provider = IpProvider::class;
}
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1924d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d77b3448b7da920367824a6c277b90589156297a68a704e46a367a6b2c4fd491?d=identicon)[kaiquegarcia](/maintainers/kaiquegarcia)

---

Top Contributors

[![kaiquegarcia](https://avatars.githubusercontent.com/u/10978468?v=4)](https://github.com/kaiquegarcia "kaiquegarcia (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kaiquegarcia-lumen-nginx-secure-link/health.svg)

```
[![Health](https://phpackages.com/badges/kaiquegarcia-lumen-nginx-secure-link/health.svg)](https://phpackages.com/packages/kaiquegarcia-lumen-nginx-secure-link)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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