medialib/proptypes

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (0.1.1) of this package.

PropType validation for PHP project inspired by React

Installs: 548

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 1

Type:typo3-flow-package

0.1.1 2016-12-01 23:48 UTC

This package is not auto-updated.

Last update: 2020-03-06 17:29:26 UTC


README

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.

Validation and default value enforcement are done with AOP.

This package require Flow 2.3, not compatibile with Flow 3.0 currently

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

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

  • any
  • array
  • bool
  • func
  • number
  • object
  • string

Supported options

  • isRequired

Acknowledgments

Development sponsored by ttree ltd - neos solution provider and medialib.tv.

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

License

Licensed under MIT, see LICENSE