Skip to content

m0nsky/nginx_secure_link

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx_secure_link

nginx_secure_link

Note: This package is still in early development stages

This PHP/Laravel package will help you to easily generate links which are secured by nginx's ngx_http_secure_link_module

Version Compatibility

Laravel nginx_secure_link PHP
5.x 1.0.x >= 5.3

Installation

Through command line:

composer require m0nsky/nginx_secure_link

Through composer.json:

{
  "require": {
    "m0nsky/nginx_secure_link": "1.0.*"
  }
}

Usage

Including the secure link class

use m0nsky\NginxSecureLink\NginxSecureLink;

Publish configuration

php artisan vendor:publish --provider="m0nsky\NginxSecureLink\Providers\NginxSecureLinkServiceProvider"

Update configuration

return [

    'base_path'     => '/var/www/path/to/files/',
    'base_url'      => 'https://example.com/url/to/files/',
    'secret'        => 'secret',
    'ttl'           => 60, // (seconds)

];

Instantiate class

Note: If no parameters are specified, the wrapper will use the settings as specified in your nginx_secure_link.php config

$nginxSecureLink = new NginxSecureLink();

or

$nginxSecureLink = new NginxSecureLink('/path/to/files/', 'https://example.com/url/to/files/', 60, 'secret');

Generate file url

$url = $nginxSecureLink->getUrl('archive.zip');

Which will return a string in the following format

https://example.com/url/to/files/archive.zip?md5=AUEnXC7T-Tfv9WLsWbf-mw&expires=1483228740

About

ngx_http_secure_link_module implementation for PHP/Laravel 5

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages