InputCatcher
The subsystem is used to catch input data and especially to convert it to the correct value - i.e. the correct data type, object, or to escape it.
The subsystem was previously part of the forms subsystem, but since mid-2026 it has become an independent and fully standalone subsystem, just like the validators subsystem.
Usage Examples
Standalone Catcher Usage
namespace JetApplication;
use Jet\Factory_InputCatcher;
use Jet\Http_Request;
use Jet\InputCatcher;
$catcher_date_time = Factory_InputCatcher::getInputCatcherInstance(
type: InputCatcher::TYPE_DATE_TIME,
name: 'date_and_time',
default_value: null
);
$catcher_date_time->catchInput( Http_Request::POST()->getRawData() );
$date_and_time = $catcher_date_time->getValue(); //Instance of Data_DateTime or null
$catcher_secure_string = Factory_InputCatcher::getInputCatcherInstance(
type: InputCatcher::TYPE_STRING,
name: 'secure_string',
default_value: ''
);
$catcher_secure_string->catchInput( Http_Request::POST()->getRawData() );
$secure_string = $catcher_secure_string->getValue(); //escaped string or empty string
Catcher Mapped to a Class
Imagine a situation where you have arbitrary data in the form of an associative array (or an instance of Jet\Data_Array) and you need to populate object properties with values from this raw data. That is tedious work, but with PHP Jet it can be solved elegantly, for example like this:
namespace JetApplication;
use Jet\Data_DateTime;
use Jet\Entity_InputCatcher_Definition;
use Jet\Entity_InputCatcher_Interface;
use Jet\Entity_InputCatcher_Trait;
use Jet\InputCatcher;
class ExampleClass implements Entity_InputCatcher_Interface
{
use Entity_InputCatcher_Trait;
#[Entity_InputCatcher_Definition(
type: InputCatcher::TYPE_DATE_TIME
)]
protected ?Data_DateTime $date_and_time = null;
#[Entity_InputCatcher_Definition(
type: InputCatcher::TYPE_STRING
)]
protected string $secure_string = '';
}
$example_object = new ExampleClass();
$config_data = require 'some/config/file.php';
$example_object->catchInput( $config_data );