Skip to content

krakphp/enum-normalizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enum Normalizer

This contains a Symfony Denormalizer for the myclabs/php-enum MyCLabs\Enum\Enum class.

Installation

Install with composer at krak/enum-normalizer.

Usage

EnumDenormalizer

$denormalizer = new Krak\EnumNormalizer\EnumDenormalizer();
$enum = $denormalizer->denormalize('value', AcmeEnum::class);

Symfony Integration

Register the EnumNormalizerBundle in your kernel in config/bundles.php:

<?php

return [
  //...
  Krak\EnumNormalizer\Bridge\Symfony\EnumNormalizerBundle::class => ['all' => true],
];