AbstractEnum subclass instances can be serialized with serialize() and unserialized with unserialize() without issues.
Instances can also be JSON-serialized with the built-in json_encode() provided that their value itself is JSON-serializable (which they ought to be: it is recommended to have only string/int/null enum constants).
Such JSON serializations of Enum instances can of course be unserialized with json_decode(). This will however not return an Enum instance but just their wrapped value:
<?php
class TriState extends \mle86\Enum\AbstractAutoEnum
{
public const HIGH = 'H';
public const LOW = 'L';
public const UNDEF = 'Z';
}
$triState = new TriState(TriState::HIGH);
$unserialized = unserialize(serialize($triState));
// This is now a second instance with the same value.
$jsonUnserialized = json_decode(json_encode($triState));
// This is now the string "H" (TriState::HIGH).