nawrasbukhari/restricted 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nawrasbukhari/restricted

最新稳定版本:1.0.1

Composer 安装命令:

composer require nawrasbukhari/restricted

包简介

Restricts registration when a user's input (eg: username) matches a list of restricted words

README 文档

README

Restricted allows you to restrict your users from signing up with reserved words.

Reserved words can be:

  1. Your route segments - Example, you have this route: www.mywebsite.com/login and your application allows to view user profile like this: www.mywebsite.com/username This package can crawl all your routes and return a validation message when a user tries to register with such words like "login"
  2. Words you just want to reserve - Example: cart, products, admin etc. These words can be added manually to the reserved.txt file. after running the "restricted:index" command.

Installation

To install Restricted use composer

Download

composer require nawrasbukhari/restricted

Publish the config

php artisan vendor:publish --provider="Nawras\Restricted\RestrictedServiceProvider" --tag="config"

Usage

First, we need to crawl and index the application routes by running the command:

php artisan restricted:index

Now, you can simply add restricted to your validations like so:

    $this->validate($request, [
        'name' => 'required|string|min:5',
        'username' => 'required|restricted'
    ]);

You can also add a new validation message

    $this->validate($request, [
        'name' => 'required|string|min:5',
        'username' => 'required|restricted'
    ],[
    	'username.restricted' => 'A user exists with that username. Please try another or add more characters'
    ]);

Settings

  • file_path: (string) File name and path to save the indexed words
  • index_level: (int) How deep do u want us to crawl your routes? ExAMPLE => www.mywebsite.com/segment1/segment2/segment3. setting this value to '2', will allow indexing of segment1 and segment2 and exclude segment3
  • merge: (bool) should we to merge the new results with the old ones

License

MIT license - free to use and abuse!

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固