Type Extractor
A type extractor is a class responsible for inferring a type from a value.
An extractor can be used both when normalizing an arbitrary value with a mapper and when using the built-in mixed type.
The mapper supports a built-in native (default) type extractor, but you can specify your own if necessary.
To specify an extractor, you must pass the desired factory to the Mapper constructor, which will create an extractor object.
use TypeLang\Mapper\Mapper;
use TypeLang\Mapper\Type\Extractor\Factory\DefaultTypeExtractorFactory;
$mapper = new Mapper(
// ...
typeExtractorFactory: new DefaultTypeExtractorFactory(),
);
05 November 2025