v1.0.0 2024-02-28 18:39 UTC

This package is auto-updated.

Last update: 2024-09-28 20:03:52 UTC


README

描述

该库包含框架模块,用于管理应用程序验证。

要求

  • 脚本语言:PHP:版本 7 或 8

安装

有几种可能的安装方式

Composer

  1. 要求

    它需要Composer安装。更多信息请访问:https://composer.php.ac.cn

  2. 命令:在项目根目录下移动

     cd "<project_root_path>"
    
  3. 命令:安装

     php composer.phar require liberty_code_module/validation ["<version>"]
    
  4. 注意

    • 包含供应商

      如果项目使用Composer,必须包含供应商

        require_once('<project_root_path>/vendor/autoload.php');
      
    • 配置

      安装命令允许在composer文件中添加

        {
            "require": {
                "liberty_code_module/validation": "<version>"
            }
        }
      

包含

  1. 下载

    • 下载以下仓库。
    • 将其放在仓库根目录下。
  2. 包含源代码

     require_once('<repository_root_path>/include/Include.php');
    

应用程序安装

配置

  1. 配置:应用程序模块:"

    在列表部分添加,所需模块

    YML配置格式的示例,来自Composer安装

     list: [
         {
             path: "/vendor/liberty_code_module/validation/src/validation",
             config_parser: {
                 type: "string_table_php",
                 source_format_get_regexp: "#^\\<\\?php\\s*(.*)(\\s\\?\\>)?\\s*$#ms",
                 source_format_set_pattern: "<?php \\n%1$s",
                 cache_parser_require: true,
                 cache_file_parser_require: true
             }
         },
         {
             path: "/vendor/liberty_code_module/validation/src/rule",
             config_parser: {
                 type: "string_table_php",
                 source_format_get_regexp: "#^\\<\\?php\\s*(.*)(\\s\\?\\>)?\\s*$#ms",
                 source_format_set_pattern: "<?php \\n%1$s",
                 cache_parser_require: true,
                 cache_file_parser_require: true
             }
         },
         {
             path: "/vendor/liberty_code_module/validation/src/cache",
             config_parser: {
                 type: "string_table_php",
                 source_format_get_regexp: "#^\\<\\?php\\s*(.*)(\\s\\?\\>)?\\s*$#ms",
                 source_format_set_pattern: "<?php \\n%1$s",
                 cache_parser_require: true,
                 cache_file_parser_require: true
             }
         }
     ]
    

配置

应用程序参数配置

  • 在您的模块中使用以下文件来配置特定元素

      <module_root_path>/config/ParamApp.php
    
  • 可配置元素

    • 到参数验证器的配置

    • 到参数缓存的配置

用法

以下示例考虑命令行应用程序相对路径为"bin/app"。

验证

功能允许设置和管理应用程序中可用的验证。

示例

cd "<project_root_path>"
...
// Get all rule names
php bin/app validation:rule:get:rule-name

规则

功能允许设置和管理适用于应用程序验证的规则。

缓存

功能允许设置和管理适用于应用程序验证的缓存。