delboy1978uk/bone-firewall
最新稳定版本:v1.4.0
Composer 安装命令:
composer require delboy1978uk/bone-firewall
包简介
Firewall package for Bone Framework
README 文档
README
Firewall package for controlling Bone Framework vendor package routes.
installation
Use Composer
composer require delboy1978uk/bone-firewall
usage
Simply add to the config/packages.php
<?php // use statements here use Bone\Firewall\Firewall\FirewallPackage; return [ 'packages' => [ // packages here..., FirewallPackage::class, ], // ... ];
blocking routes
And add a list of blockedRoutes to your config. As an example here, package delboy1978uk/bone-user has an endpoint
for a visitor to register a user account. If you don't want endpoints like these exposed you can add the path that is
configured in the package's addRoutes(Container $c, Router $router) method that adds the routes, you can use the
wildcard strings too as shown here.
<?php return [ 'blockedRoutes' => [ '/user/register', '/user/lost-password/{email}', ], ];
adding middleware
Sometimes you might want to add middleware to a route coming from a vendor package, you can do this also by adding the following config key. Each key can hold either an actual instance of the middleware, a string representing the middleware which would be found in the container, or an array of either if you wish to add multiple middlewares.
return [ 'blockedRoutes' => [ // etc ], 'routeMiddleware' => [ '/api/some/endpoint' => SomeMiddleware::class, '/api/another/endpoint' => new AwesomeMiddleware(), '/api/yet/another/endpoint' => [ new AwesomeMiddleware(), SomeMidlleware::class, ], ], ];
统计信息
- 总下载量: 2.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-10