2017 © Pedro Peláez
 

typo3-flow-package proptypes

PropType validation for PHP project inspired by React

image

medialib/proptypes

PropType validation for PHP project inspired by React

  • Friday, December 2, 2016
  • by medialibtv
  • Repository
  • 1 Watchers
  • 0 Stars
  • 386 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

Medialib.PropTypes

Validate the properties passed to your constructor with class annotation. Can be used in any Flow Framework project. Your constructor must support a single variable and this variable should be an array. You can also enfore default values., (*1)

Validation and default value enforcement are done with AOP., (*2)

This package require Flow 2.3, not compatibile with Flow 3.0 currently, (*3)

This is a preliminary realease, not considered stable and complet, API should change, and performance must be improved, (*4)

How to use it ?

use Medialib\PropTypes\Annotations as Props;

/**
 * EmitMessageOptions
 *
 * @api
 *
 * @Props\Types(
 *    subject = "string.isRequired",
 *    payload = "array",
 *    unique = "bool",
 *    connection = "string"
 * )
 *
 * @Props\Defaults(
 *    connection = "default"
 * )
 */
class EmitMessageOptions
{
    /**
     * @param array $options
     */
    public function __construct(array $options)
    {
        $this->subject = $options['subject'];
        $this->payload = $options['payload'];
        $this->unique = $options['unique'];
        $this->connection = $options['connection'];
    }
}

Supported types

  • [x] any
  • [x] array
  • [x] bool
  • [x] func
  • [x] number
  • [x] object
  • [x] string

Supported options

  • [x] isRequired

Acknowledgments

Development sponsored by ttree ltd - neos solution provider and medialib.tv., (*5)

We try our best to craft this package with a lots of love, we are open to sponsoring, support request, ... just contact us., (*6)

License

Licensed under MIT, see LICENSE, (*7)

The Versions

02/12 2016

dev-master

9999999-dev

PropType validation for PHP project inspired by React

  Sources   Download

The Requires

 

02/12 2016

0.1.1

0.1.1.0

PropType validation for PHP project inspired by React

  Sources   Download

The Requires

 

21/06 2016

0.1

0.1.0.0

PropType validation for PHP project inspired by React

  Sources   Download

The Requires