shaggy8871/php-rx
Composer 安装命令:
composer require shaggy8871/php-rx
包简介
The Rx schema and validation system
README 文档
README
PHP implementation of Rx validation library
Based on https://github.com/rjbs/Rx with ideas from https://blog.picnic.nl/how-to-use-yaml-schema-to-validate-your-yaml-files-c82c049c2097
What is Rx?
When adding an API to your web service, you have to choose how to encode the data you send across the line. XML is one common choice for this, but it can grow arcane and cumbersome pretty quickly. Lots of webservice authors want to avoid thinking about XML, and instead choose formats that provide a few simple data types that correspond to common data structures in modern programming languages. In other words, JSON and YAML.
Unfortunately, while these formats make it easy to pass around complex data structures, they lack a system for validation. XML has XML Schemas and RELAX NG, but these are complicated and sometimes confusing standards. They're not very portable to the kind of data structure provided by JSON, and if you wanted to avoid XML as a data encoding, writing more XML to validate the first XML is probably even less appealing.
Rx is meant to provide a system for data validation that matches up with JSON-style data structures and is as easy to work with as JSON itself.
Installation
composer require shaggy8871/php-rx
Documentation
Usage
- Create a schema file
- Run
./vendor/bin/rx <yaml/json> <schema> ["<glob of custom types>"] - Be sure to quote custom type glob!
For example, ./vendor/bin/rx test.yml schema.yml "types/*.yml"
shaggy8871/php-rx 适用场景与选型建议
shaggy8871/php-rx 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 990 次下载、GitHub Stars 达 11, 最近一次更新时间为 2019 年 06 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 shaggy8871/php-rx 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shaggy8871/php-rx 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 990
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2019-06-08