sschlein / obscure
隐藏您Laravel 5应用中的请求和URL的ID
0.1.0
2016-02-11 19:06 UTC
Requires
- php: >=5.4.0
- hashids/hashids: 1.0.5
- illuminate/support: ~5.1
Requires (Dev)
- guzzlehttp/guzzle: >=4.0
- illuminate/database: ~5.0
- illuminate/events: ~5.0
- mockery/mockery: dev-master
- orchestra/testbench: ~3.0
- phpunit/phpunit: 4.7.*
This package is not auto-updated.
Last update: 2024-09-14 19:36:34 UTC
README
从URL和表单中隐藏ID
隐藏您的Laravel 5应用程序的ID以从URL和请求中。它基于流行的Hashids包
// http://exampleapplication.com/user/ALnLzW Route::get('/user/{id}', function ($id) { return "ID: " . $id; //returns a number })->middleware('obscure');
内容
## 安装要将obscure添加到您的项目中,只需将以下内容添加到您的composer.json中:
"sschlein/obscure": "dev-develop" 然后运行composer install或composer update。
或者,如果您更喜欢,可以运行composer require sschlein/obscure 。
将服务提供者添加到您的应用程序
在您的config\app.php文件中,将obscure服务提供者添加到providers数组。
// ... Sschlein\Obscure\ObscureServiceProvider::class, // ...
在您的.env文件中设置一个盐散列以生成唯一的散列。
OBSCURE_SALT=your-unique-phrase
将中间件添加到您的Kernel中
在您的app\Http\Kernel.php文件中,将obscure中间件添加到$routeMiddleware数组。
protected $routeMiddleware = [ // ... 'obscure' => \Sschlein\Obscure\Middleware\Obscure::class, // ... ];## 使用方法