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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners