Git Product home page Git Product logo

abyss's Introduction

hypnotox/abyss

CI Status Code Coverage Packagist Version Packagist PHP Version Support GitHub

A PHP package implementing array to object schema validation and mapping. (The idea of this package has changed a bit and might change again in the future)

The package is currently not in any usable / stable state, but is in active development towards a target. It will be tagged as soon as base functionality is present and tested.

This package is very experimental and can change very much pre version 1.0!

This is just a personal project, but follows semantic versioning and will be stable once reaching its first major release.

PRs are welcome.

Target constraints

  • Type constraint
    • Scalars
      • int, string, float, bool
    • Array (I'm currently unsure if \Traversable should be allowed)
      • list<T>
      • map<K, T>
    • Objects
      • instanceof T
  • Value constraint
    • Scalar
      • Numeric
        • equal to / inside bounds
      • String
        • equal to
        • regex
      • Enum
    • Array
      • size equal to / inside bounds
      • nested array
  • Object shape constraint
  • Custom constraints

Installation

Simply require it using composer: composer require hypnotox/abyss

Features

// TODO

Usage

// TODO

abyss's People

Contributors

hypnotox avatar szepeviktor avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

szepeviktor

abyss's Issues

Structure rework

@szepeviktor I just pushed a new branch with an initial set of classes which should show the structure i have in mind right now.
It's still very early into the concept, but if you see any problems or have any ideas with it you can bring them up here.

Pure lists

Please consider adding a check for lists, arrays with the same element type with zero-based increasing integer keys.

[
    'apple',
    'pear',
    'pineapple',
]

[
    0 => 'apple',
    1 => 'pear',
    2 => 'pineapple',
]

Playing with the schema

- name: "person's name"
  key: "name"
  value-type: "string"
  constraints:
    - min_length: 2
    - max_length: 40
- key: "age"
  value-type: "integer"
  constraints:
    - min_value: 18
    - max_value: 120
- key: "ratings"
  value-type: "array"
  elements:
    - key: "silly"
      value-type: "float"
      constraints:
        - min_value: -1.0
    - key: "billy"
      value-type: "float"
- key: "attributes"
  value-type: "list"
  elements:
    - value-type: "string"
      constraints:
        - min_length: 1
- key: "mess"
  value-type: "array"
  elements:
    - key-type: "integer"
      value-type: "string"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.