承接 weew/config-schema 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

weew/config-schema

Composer 安装命令:

composer require weew/config-schema

包简介

Schema builder for the weew/config package.

README 文档

README

Build Status Code Quality Test Coverage Version Licence

Table of contents

Installation

composer require weew/config-schema

Introduction

This package allows easy config validation and is used in combination with the weew/config package.

Usage

You can describe your config schema like this:

$config = new Config([
    'some' => 'value',
    'items' => ['foo', 'bar'],
    'name' => 'John Doe',
]);
$schema = new ConfigSchema($config);

$schema
    ->hasValue('some')
    ->hasArray('items')->allowed(['foo', 'baz'])
    ->hasString('name')->min(3)->max(10)
;

After you've described your schema, you can either validate it, which will return you an instance of IValidationResult, or assert it, which will throw an exception.

$result = $schema->check();

foreach ($result->getErrors() as $error) {
    echo $error->getSubject() . ' ' . $error->getMessage();
}

// or

try {
    $schema->assert();
} catch (ConfigValidationException $ex) {
    $result = $ex->getValidationResult();
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固