Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

The contents of the Rx repository are copyright (C) 2008, Ricardo SIGNES.
The contents of the Rx repository are released under the GNU General Public License

* Copyright (C) 2019, J Ginsberg (./php)
* Copyright (C) 2008, Ricardo SIGNES

They may be distributed under the terms of the GNU General Public License,
below. The Perl implementation, Data::Rx, may also be distributed under the
Expand Down
1 change: 1 addition & 0 deletions php/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor/**
45 changes: 45 additions & 0 deletions php/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Shaggy8871\Rx

[![Author](https://img.shields.io/badge/author-@shaggy8871-blue.svg?style=flat-square)](https://twitter.com/johnginsberg)
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat-square)](https://github.com/shaggy8871/Rx/blob/master/LICENSE)

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

Standalone PHP version is available at https://github.com/shaggy8871/php-rx

## 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

[Check out the documentation](http://rx.codesimply.com/)

## 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"`
Loading