PHPackages                             prezly/prop-types - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. prezly/prop-types

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

prezly/prop-types
=================

Complete PHP port of React PropTypes

1.3.3(2y ago)7151.0k↓20.1%5[2 issues](https://github.com/prezly/prop-types-php/issues)MITPHPPHP &gt;=7.1

Since Dec 27Pushed 2y ago4 watchersCompare

[ Source](https://github.com/prezly/prop-types-php)[ Packagist](https://packagist.org/packages/prezly/prop-types)[ RSS](/packages/prezly-prop-types/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (13)Used By (0)

PropTypes.php
=============

[](#proptypesphp)

Complete PHP port of [React PropTypes](https://github.com/facebook/prop-types).

Runtime type checking for complex properties structures.

You can use prop-types to document the intended types of properties passed into your code. PropTypes will check props passed to your functions against those definitions, and throw an error if they don’t match.

[![Build status](https://github.com/prezly/prop-types-php/workflows/Test/badge.svg)](https://github.com/prezly/prop-types-php/workflows/Test/badge.svg)

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

[](#installation)

```
composer require prezly/prop-types

```

Usage
-----

[](#usage)

PropTypes was originally exposed as part of the React core module, and is commonly used with React components. We've tried to bring the familiarity of React PropTypes into PHP.

You can call `PropTypes::check()` to validate an array of props, providing it with a props spec as below:

```
