linelab-studio/zf2-validator-api-client 问题修复 & 功能扩展

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

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

linelab-studio/zf2-validator-api-client

Composer 安装命令:

composer require linelab-studio/zf2-validator-api-client

包简介

ZF2 Validator

README 文档

README

Validator Email and Phone - Zend Framework 2.

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "require": {
    "linelab-studio/zf2-validator-api-client": "1.0.1"
  }
}

Then run composer install

Usage

Add configuration data. The configuration can be in the module configuration or in the project autoload files.

'LabValidator' => [
    'apiKey' => 'exampleApiKey',
    'host' => 'https://localhost/validator/api'
],

Creation of the ZF2 Validator class.

Two validators are available:

  • EmailValidator (namespace LabValidator\EmailValidator)
  • PhoneValidator (namespace LabValidator\PhoneValidator)
<?php
namespace App\Validator;

class EmailAddressValidator extends LabValidator\EmailValidator
{
    public function __construct(array $config = null)
    {
        parent::__construct($config);
    }
}
?>

Adding a validator to the field in the form

public function validatorAction()
{
    $form = new Form();
    $form
       ->add([
            'name' => 'email',
            'type' => 'email',
            'attributes' => [
                'required' => true,
            ],
            'options' => [
                'label' => 'Email',
                'validators' => [
                    $this->serviceLocator->get(EmailAddressValidator::class)
                ]
            ]
        ]);
}

Author

studio@linelab.pl

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固