定制 mitchellston/form_validation 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mitchellston/form_validation

最新稳定版本:1.0

Composer 安装命令:

composer require mitchellston/form_validation

包简介

This should help with validating POST and GET request in PHP!

README 文档

README

This project aims to make validation for POST and GET requests easier. The way we get this done is by making the way validation work similar to the input tag of HTML.

Getting Started

These instructions will give you a working project with this library.

Prerequisites

Requirements for the software and other tools to build, test and push

  • PHP 7.4 or higher
  • Composer

Installing

A step by step series of examples that tell you how to get a development environment running.

Start a composer project

Composer init

Install the library with composer

Composer require mitchellston/form_validation

Add the library to the composers autoloader (in composer.json)

{
  "autoload": {
    "classmap": [
      "./vendor/mitchellston/"
    ]
  }
}

Update composer autoloader

Composer update

Demo

<?php
//Let's pretend the url is https://www.test.com?username=carl
require_once "../vendor/autoload.php";
use PostGetRequestValidation\Attributes;
use PostGetRequestValidation\Methods;
use PostGetRequestValidation\Types;
use PostGetRequestValidation\Validation;

$test = new Validation("username", Methods::GET, Types::TEXT, 
[
    Attributes::minLength => ["value" => 5, "errorMessage" => "A username needs to at least be 5 characters long!"]
]);
echo $test->getValue(); # carl
echo $test->getErrors(); # ["A username needs to at least be 5 characters long!"]
//Now you can send back the errors to your users

License

This project is licensed under the MIT License - see the LICENSE file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固