PHPackages                             packagefactory/atomicfusion-proptypes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. packagefactory/atomicfusion-proptypes

ActiveNeos-package[Utility &amp; Helpers](/categories/utility)

packagefactory/atomicfusion-proptypes
=====================================

Fusion port of react-propTypes for the fusion-prototypes PackageFactory.AtomicFusion:Component and Neos.Fusion:Component

v2.2.1(7mo ago)12212.2k↓42.9%4[5 issues](https://github.com/PackageFactory/atomic-fusion-proptypes/issues)[1 PRs](https://github.com/PackageFactory/atomic-fusion-proptypes/pulls)4GPL-3.0-or-laterPHPCI failing

Since Jan 31Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/PackageFactory/atomic-fusion-proptypes)[ Packagist](https://packagist.org/packages/packagefactory/atomicfusion-proptypes)[ RSS](/packages/packagefactory-atomicfusion-proptypes/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (1)Versions (23)Used By (4)

PackageFactory.AtomicFusion.PropTypes
=====================================

[](#packagefactoryatomicfusionproptypes)

[![Build Status](https://camo.githubusercontent.com/ff0770a2e238ee67f83493c5173c4899f71c3be6cc495e87676f91d2da8bc689/68747470733a2f2f7472617669732d63692e6f72672f5061636b616765466163746f72792f61746f6d69632d667573696f6e2d70726f7074797065732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PackageFactory/atomic-fusion-proptypes)

> Validate the props passed to a component via `@propType` annotation. The syntax for the propType annotation is derived from react-propTypes.

*ATTENTION: This package is by default only validating the props in development-context.*

```
prototype(Vendor.Site:Example) < prototype(Neos.Fusion:Component) {
    @propTypes {
        # optional, enforce that only validated props exist
        @strict = true
        # validation rules for props
        title = ${PropTypes.string.isRequired}
        subtitle = ${PropTypes.string}
    }
}

```

This will validate the given props with the validator that created in the @propTypes section via.

Fusion Validator Prototypes
---------------------------

[](#fusion-validator-prototypes)

Proptypes can also be specified via fusion objects.

```
@propTypes {
    # all props can be marked as required via `@required = true`
    int = PropTypes:Int {
      @required = true
    }
    float = PropTypes:Float
    bool = PropTypes:Bool

    # strings allow to specify an optional `regularExpression`
    string = PropTypes:String {
        regularExpression = '/hello world/'
    }

    # allows array values that satisfy the `type`
    array = PropTypes:Array {
        type = PropTypes:Int
    }

    # allow values that satisfy one of the given validators
    union = PropTypes:Union {
        int = PropTypes:Int
        string = PropTypes:String
        ...
    }

    # allow exacly the values that are specified
    enum = PropTypes:Enum {
      value1 = "foo"
      value2 = "bar"
      ...
    }

    # a nested structure that is valid once all children valídate
    dataStructure = PropTypes:DataStructure {
        title = PropTypes:String
        description = PropTypes:String
        ...
    }

    # a php object that satisfies the given interface
    instanceOf = PropTypes:InstanceOf {
        type = '\DateTimeInterface'
    }

    # data structure validator that uses the defined proptypes from another prototype
    fromPrototype = PropTypes:FromPrototype {
        prototypeName = "Vendor.Site:Prototype"
    }
}

```

Methods that are supported by the propTypes helper
--------------------------------------------------

[](#methods-that-are-supported-by-the-proptypes-helper)

- `PropTypes.any`: Accepts any value including null.
- `PropTypes.boolean`: Validate that a boolean value is given, accepts null.
- `PropTypes.integer`: Validate that an integer is given, accepts null.
- `PropTypes.float`:
    Validate that an float is given, accepts null.
- `PropTypes.string`:
    Validate that an string is given, accepts null.
- `PropTypes.regex('/pattern/')`: Validate that the given string matches the pattern
- `PropTypes.oneOf([123, "foo", "bar"])`: Validate the value equals one of the given options.
- `PropTypes.arrayOf( PropTypes.string )`: Validate an array was given and all validate with the given validator, accepts null.
- `PropTypes.anyOf( PropTypes.string, PropTypes.integer )`: Validate the value validates at least with one of the given validators, accepts null.
- `PropTypes.dataStructure({'foo': PropTypes.integer, 'bar': PropTypes.string})`: Validate the keys of the given array validate with the assigned Validator, accepts null and ignores all other keys. The key validators have to define wether a single key is required.
- `PropTypes.shape({'foo': PropTypes.integer, 'bar': PropTypes.string})`: Validate the keys of the given array validate with the assigned Validator, accepts null and ignores all other keys. The key validators have to define wether a single key is required.
- `PropTypes.fileExists`: Validate that a given value is an existing file.
- `PropTypes.instanceOf('Neos.Neos:Document')`: Validate the value with the given type, if the value is a Node the NodeType is checked instead of the php-class, accepts null.

### Making values mandatory

[](#making-values-mandatory)

- `PropTypes.*.isRequired`: To ensure a value is given the isRequired-method can be called after the type-validation. This adds an additional notEmpty validator to enforce that a value is given.

How it works
------------

[](#how-it-works)

If the validation is enabled an aspect is wrapped around the evaluate method of Neos.Fusion:Component and PackageFactory.AtomicFusion:Component implementations.

This aspect will evaluated the keys in the `@propTypes` section wich are expected to return Flow-Validators (`Neos\Flow\Validation\Validator\ValidatorInterface`). Next the current prop-value ford each key is evaluated and passed to the validator. If any of the validation results contains errors a fusion-error is thrown.

The `PropTypes`-EelHelper is a wrapper around the `PackageFactory\AtomicFusion\PropTypes\Validators\PropTypeValidator`which is an EelHelper and Validator at the same time. This Object is creates an compound-validator that is controlled in a react-propTypes like syntax via eel.

By creating FusionObjects or EelHelpers that return custom validators you can extend this mechanism if needed.

### Strict mode

[](#strict-mode)

In strict mode an error is thrown if an unvalidated prop is passed to a component in development context. This ensures that all props are validated.

To enable strict mode for a component add `@strict = true` to the `@propTypes`.

```
prototype(Vendor.Site:Example) < prototype(Neos.Fusion:Component) {
    @propTypes {
        @strict = true
        ...
    }
}

```

Settings
--------

[](#settings)

The propType-validation is enabled via settings. By default this setting is enabled for `Development` and `Testing` context but not enabled for `Production`.

```
PackageFactory:
  AtomicFusion:
    PropTypes:
      enable: false
```

Installation
------------

[](#installation)

PackageFactory.AtomicFusion.PropTypes is available via packagist. Just run `composer require packagefactory/atomicfusion-proptypes`.

We use semantic-versioning so every breaking change will increase the major-version number.

License
-------

[](#license)

see [LICENSE file](LICENSE)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance56

Moderate activity, may be stable

Popularity42

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 88.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~204 days

Recently: every ~295 days

Total

15

Last Release

213d ago

Major Versions

v1.3.1 → v2.0.02019-09-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/1159e78bff9c03cc5ed626447ca5072097107f58af459a9b8bac8d933ba8298c?d=identicon)[wilhelm.behncke](/maintainers/wilhelm.behncke)

![](https://www.gravatar.com/avatar/829b4ccb51e8cff3c1e4b59d60cfe8d1b86f6d77fc31a6b3fc99227f432542ca?d=identicon)[mficzel](/maintainers/mficzel)

---

Top Contributors

[![mficzel](https://avatars.githubusercontent.com/u/1309380?v=4)](https://github.com/mficzel "mficzel (127 commits)")[![grebaldi](https://avatars.githubusercontent.com/u/2522299?v=4)](https://github.com/grebaldi "grebaldi (13 commits)")[![gjwnc](https://avatars.githubusercontent.com/u/19683930?v=4)](https://github.com/gjwnc "gjwnc (1 commits)")[![mhsdesign](https://avatars.githubusercontent.com/u/85400359?v=4)](https://github.com/mhsdesign "mhsdesign (1 commits)")[![skurfuerst](https://avatars.githubusercontent.com/u/190777?v=4)](https://github.com/skurfuerst "skurfuerst (1 commits)")

### Embed Badge

![Health badge](/badges/packagefactory-atomicfusion-proptypes/health.svg)

```
[![Health](https://phpackages.com/badges/packagefactory-atomicfusion-proptypes/health.svg)](https://phpackages.com/packages/packagefactory-atomicfusion-proptypes)
```

###  Alternatives

[neos/neos

An open source Content Application Platform based on Flow. A set of core Content Management features is resting within a larger context that allows you to build a perfectly customized experience for your users.

1151.0M777](/packages/neos-neos)[neos/fusion-form

Fusion Form

19776.4k47](/packages/neos-fusion-form)[neos/fusion-afx

JSX inspired compact syntax for Neos.Fusion

26984.8k63](/packages/neos-fusion-afx)[sandstorm/neostwofactorauthentication

1327.0k](/packages/sandstorm-neostwofactorauthentication)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
