2017 © Pedro Peláez
 

library fadoc

Form Array to Domain Object Converter/Validator

image

tyam/fadoc

Form Array to Domain Object Converter/Validator

  • Monday, June 11, 2018
  • by tyam
  • Repository
  • 1 Watchers
  • 0 Stars
  • 55 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 5 Versions
  • 57 % Grown

The README.md

fadoc

fadoc automatically converts Form-Arrays and Domain-Objects to each other according to type declarations of methods., (*1)

Feature

  • Conversion is done automatically according to method declarations of domain objects. No Form classes.
  • You can define validation logics on domain objects.
  • Supports factories, abstract classes/interfaces.

Basic Usage

class Point {
    private $x, y;
    public function __construct(int $x, int $y) {...}
}
class Circle {
    private $c, $r;
    public function __construct(Point $c, int $r) {...}
    public function intersects(Circle $another): bool {...}
}

$form = ['another' => [
           'c' => ['x' => '0', 'y' => '20'],
           'r' => '10'
        ]];
$c = new tyam\fadoc\Converter();
$condition = $c->objectize(['my\domain\Circle', 'intersects'], $form);
if ($condition->isFine()) {
    list($another) = $condition->get();
    $result = $myCircle->intersects($another);
} else {
    // validation error...
}

Installation

$ composer require tyam/fadoc

fadoc depends on tyam/condition, which also is my library., (*2)

Documentation

Lisence

MIT, (*3)

The Versions

11/06 2018

dev-master

9999999-dev https://github.com/tyam/fadoc

Form Array to Domain Object Converter/Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by YAMADA, Tetsuo

11/06 2018

0.1.3

0.1.3.0 https://github.com/tyam/fadoc

Form Array to Domain Object Converter/Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by YAMADA, Tetsuo

13/03 2018

0.1.2

0.1.2.0 https://github.com/tyam/fadoc

Form Array to Domain Object Converter/Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by YAMADA, Tetsuo

13/03 2018

0.1.1

0.1.1.0 https://github.com/tyam/fadoc

Form Array to Domain Object Converter/Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by YAMADA, Tetsuo

29/01 2018

0.1.0

0.1.0.0 https://github.com/tyam/fadoc

Form Array to Domain Object Converter/Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by YAMADA, Tetsuo