PHPackages                             alt3/cakephp-validation-exposer - 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. alt3/cakephp-validation-exposer

AbandonedArchivedCakephp-plugin[Validation &amp; Sanitization](/categories/validation)

alt3/cakephp-validation-exposer
===============================

Easily expose your CakePHP 3.x application validation rules

1.0.2(10y ago)91933MITPHPPHP &gt;=5.4.16

Since May 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/alt3/cakephp-validation-exposer)[ Packagist](https://packagist.org/packages/alt3/cakephp-validation-exposer)[ RSS](/packages/alt3-cakephp-validation-exposer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (1)Versions (8)Used By (0)

cakephp-validation-exposer
==========================

[](#cakephp-validation-exposer)

[![Build Status](https://camo.githubusercontent.com/7d80a1f7cf62cddcd20cd062037d37e09b101b9872105369666d4c9836c8a44f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616c74332f63616b657068702d76616c69646174696f6e2d6578706f7365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/alt3/cakephp-validation-exposer)[![StyleCI Status](https://camo.githubusercontent.com/777495e5eb0344bd9b94fa19b8a35488b62918db7192485c1c9ac72ce12fb007/68747470733a2f2f7374796c6563692e696f2f7265706f732f35393336363638302f736869656c64)](https://styleci.io/repos/59366680)[![codecov](https://camo.githubusercontent.com/b69897204261521a75d02da4ad865e0190c2b73704b80f1208f521c5f50830cf/68747470733a2f2f636f6465636f762e696f2f67682f616c74332f63616b657068702d76616c69646174696f6e2d6578706f7365722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/alt3/cakephp-validation-exposer)[![Total Downloads](https://camo.githubusercontent.com/bb76bf06796f079dcb3606cdeef81fc96b5d538b6f30fbac144c92f1c678dc4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c74332f63616b657068702d76616c69646174696f6e2d6578706f7365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alt3/cakephp-validation-exposer)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

Easily expose your CakePHP 3.x application validation rules.

[![Abandoned repository](./abandoned-repo.png "This repository is no longer maintained.")](./abandoned-repo.png)

Why use it?
-----------

[](#why-use-it)

Exposing your application's validation rules can be very useful for e.g. completely separated frontend applications. Imagine a React frontend for your API being able to realtime configure (very fast) local validation rules exactly matching your CakePHP API backend's validation rules. Some benefits:

- no more mismatches between local and backend validations
- backend validation changes instantly applied in frontend application
- no more fire-and-hope POSTing of data
- less local 412 validation errors

Requirements
------------

[](#requirements)

- CakePHP 3.0+

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

[](#installation)

1. Install the plugin using composer:

    ```
    composer require alt3/cakephp-validation-exposer:"^1.0"
    ```
2. To enable the plugin either run the following command:

    ```
    bin/cake plugin load Alt3/ValidationExposer
    ```

    or manually add the following line to your `config/bootstrap.php` file:

    ```
    Plugin::load('Alt3/ValidationExposer');
    ```

Usage
-----

[](#usage)

1. Create a `ValidationExposer` object anywhere in your application
2. Call the `rules()` method
3. Present the returned array with validation information any way you see fit

### API example

[](#api-example)

```
