Typed Data Typed Data library. use AndyTruong\TypedData\Manager; $manager = new Manager(); $manager->getDataType(['type' => 'boolean'], true);