PHP code example of spacetab-io / transformation-php

1. Go to this page and download the library: Download spacetab-io/transformation-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

spacetab-io / transformation-php example snippets


use Spacetab\Transformation\ValidationError;
use Spacetab\Transformation\ValidationTransformation;

$error = new ValidationError();
$error->addError('user.first_name', 'Minimal length allowed is 2 symbols.');
$error->addError('user.first_name', 'Must be like regular expression /[a-zA-Z]+/.');

$transform = new ValidationTransformation($error);
$transform->doTransform(); // return transformed data (mixed type)