Download the PHP package sschlein/obscure without Composer
On this page you can find all versions of the php package sschlein/obscure. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sschlein/obscure
More information about sschlein/obscure
Files in sschlein/obscure
Package obscure
Short Description Obscure IDs in requests and URLs of you Laravel 5 app
License MIT
Homepage http://github.com/sschlein/obscure
Informations about the package obscure
Obscure
Hide IDs from URLs and forms
Obscure your Laravel 5 applications IDs from URLs and requests. It's based on the popuplar Hashids package
Contents
- Installation
- Usage
- Optional Configuration
- License
Installation
In order to add obscure to your project, just add
"sschlein/obscure": "dev-develop"
to your composer.json. Then run composer install
or composer update
.
Or run composer require sschlein/obscure
if you prefer that.
Add the service provider to your app
In your config\app.php
file, add the obscure service provider to providers
array.
Set a salt hash in your .env
file to generate unique hashs.
Add the middleware to your Kernel
In your app\Http\Kernel.php
file, add the obscure middleware to the $routeMiddleware
array.
Usage
By default, Obscure looks for routes or request parameters with a parameter named id
.
To modify this parameter, add it as a middleware parameter like this:
If this parameter is present, it gets decoded to the id and can be used without applications changes.
To generate routes or request parameters, you can use the blade extension. In a blade template, just use
If you need to obscure the id within a controller, use the facade
That's it.
Optional Configuration
Obscure uses some defaults that can be configured. To change the default configuration, publish the config.
You can now configure the salt
hash, the length
of the hash and the used alphabet
of the hash in the config/obscure.php
.
License
Obscure is free software distributed under the terms of the MIT license.