Download the PHP package jcergolj/request-input-transformer-for-laravel without Composer

On this page you can find all versions of the php package jcergolj/request-input-transformer-for-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package request-input-transformer-for-laravel

Request Input Transformer for Laravel

Clean up your prepareForValidation() — the right way.

Latest Version on Packagist

Total Downloads


Why?

If you’ve built more than a couple of Laravel apps, you’ve probably ended up stuffing too much logic into prepareForValidation().

Maybe you’ve written code like this:

We've all been there — a quick trim() here, a lower() there. But soon, prepareForValidation() is packed with string cleanup, formatting, and conditionals.

This package solves this.

Installation

Under the Hood: Pipeline Pattern

This package uses Laravel’s Pipeline Pattern under the hood.

That means your modifiers and transformers are run one by one, just like middleware — each one gets the current value (or request), does its thing, and passes it to the next.

Modifiers vs Transformers

This package gives you two ways to work with request input: modifiers and transformers.

🛠 Modifiers

Modifiers change values of existing fields in the request — great for cleanup and normalization.

Use modifiers when the field already exists and you need to modify only that field .

Modifiers merges fields automatically inside pipeline then method.

🔄 Transformers

Transformers have access to the entire request and can add or change fields based on logic, relationships, or conditions.

Use transformers when you need to generate new fields or apply logic that involves more than one input.

Nested Input Support

This package supports nested input keys — including wildcard syntax — out of the box. You can apply modifiers or transformers to fields like:

Usage

Step 1: Create a Modifier and Transformer

Modifier: Trim strings

Transformer: Generate a full name from first and last name

Step 2: Apply in a FormRequest

Generating Modifiers and Transformers

To quickly create modifier or transformer classes, you can use the included Artisan commands:

Testing

What about testing modifiers and transformers?

One of the challenges with prepareForValidation() is that Laravel doesn't offer a clean way to test if it actually ran — especially when you're trying to do as much on a unit level as possible.

I initially tried building custom PHPUnit assertions that would inspect the applied modifiers and transformers, but it quickly became complicated.

My current workaround

A practical alternative is to expose two public methods inside your FormRequest class — one returning modifiers, the other transformers — and then test those separately.

Example:

Now in your test, you can do something like this:

This doesn’t guarantee that RequestPreprocessor was actually called inside prepareForValidation() — but it does confirm the configuration.

Mocking the RequestPreprocessor in Tests

Something that I haven't tried but it might actually work is using reflection for prepareForValidation and to mock RequestPreprocessorFacade.

Something like this.

Testing

To run the tests:

License

The MIT License (MIT).


All versions of request-input-transformer-for-laravel with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jcergolj/request-input-transformer-for-laravel contains the following files

Loading the files please wait ....