Index

Serialize

MMO\core\attributes · 1 symbol · generated 5 Oct 2026

class

Serialize

Serialize.php:24

This attribute is used to alter the serialization process.

#[Attribute(8)] class MMO\core\attributes\Serialize
Namespace
MMO\core\attributes
NOTE: By default, all the properties of an object are serialized. the serialized and unserialized properties allow to: - if false: won't serialize/unserialize data - if null: use instance property - if a string: use the public method to get/set the property function unserialize(mixed $value): void function serialize(array $options): mixed. You don't need to serialize inner values, the serialization will do it. The order is used to order the priority of properties. It is done in ascending order.
#[Serialize(false)] protected array $cachedStuff = []; // never serialized/unserialized #[Serialize(null, 'setLanguage')] protected string $lang = ''; // read directly, written via setLanguage() #[Serialize(serialize: 'getPaths', unserialize: 'setPaths', order: -100)] protected array $paths = []; // both custom, applied first

Properties3

order

readonly
readonly int $order
Type
int

serialize

readonly
readonly string|bool|null $serialize
Type
string | bool | null

unserialize

readonly
readonly string|bool|null $unserialize
Type
string | bool | null

Methods1

__construct($serialize, $unserialize, $order)

Serialize.php:32
function __construct( string|bool|null $serialize = null, string|bool|null $unserialize = null, int $order = 0 )
$serialize = nullstring | bool | nullfalse: never export; null: read the raw property; string: call this method (function (): mixed, taking no serialization-specific args of its own)
$unserialize = nullstring | bool | nullfalse: never import; null: write the raw property; string: call this method (function (mixed $value): void)
$order = 0intlower runs first, relative to this class's other #[Serialize]d properties