krak/enum-normalizer

Symfony Normalizer/Denormalizer for myclabs/enum

v1.1.0 2023-02-27 16:44 UTC

This package is auto-updated.

Last update: 2024-11-27 20:24:45 UTC


README

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],
];