The Transformer is a php package for transforming values or input. It is powered by the Laravel framework's validation components.

For example, preg_replace accepts the value to change as the 3rd argument: $input = ['phone_number'=>'123-456-3235']; $transformers = [ 'example'=>'preg_replace:/[^0-9]/,,:value:', ]; $transformer = new DataTransformer($input, $transformers); $transformer->transform(); Optional Transformation/Blank Input

$transformer = new DataTransformer($input, $transformers); $transformer->transform(); Note: This package uses Laravel's blank helper to determine blank/empty values.

You can use closures for transforming your value as well: $input = ['first_name'=>' Bob']; $transformers = [ 'first_name'=>['trim', function ($value) { // change the value.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners