Menu

## Serialization

Serialization.php : 39

Trait Serialization.

Serialization and JSON stuff.

Depends on the following properties:

### Table of Contents

#### Properties

$daysInMonth : int
$month : int
$quarter : int
$year : int
$dumpDateProperties : array<string|int, mixed>|null
  Embed date properties to dump in a dedicated variables so it won't overlap native DateTime ones.
$dumpLocale : string|null
  Locale to dump comes here before serialization.
$dumpProperties : array<string|int, string>
  List of key to use for dump/serialization.

#### Methods

__serialize() : array<string|int, mixed>
  Returns the values to dump on serialize() called on.
__set_state() : static
  The __set_state handler.
__sleep() : array<string|int, mixed>
  Returns the list of properties to dump on serialize() called on.
__unserialize() : void
  Set locale if specified on unserialize() called.
__wakeup() : void
  Set locale if specified on unserialize() called.
cleanupDumpProperties() : self
  Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.
fromSerialized() : static
  Create an instance from a serialized string.
jsonSerialize() : mixed
  Prepare the object for JSON serialization.
locale() : string|static
serialize() : string
  Return a serialized string of the instance.
serializeUsing() : void
toJSON() : string
dumpTimezone() : mixed
getSleepProperties() : array<string|int, mixed>

### Properties

#### $daysInMonth

Serialization.php : 0
`public int $daysInMonth`

#### $month

Serialization.php : 0
`public int $month`

#### $quarter

Serialization.php : 0
`public int $quarter`

Depends on the following methods:

#### $year

Serialization.php : 0
`public int $year`

#### $dumpDateProperties

Serialization.php : 63

Embed date properties to dump in a dedicated variables so it won't overlap native DateTime ones.

`protected array<string|int, mixed>|null $dumpDateProperties`

#### $dumpLocale

Serialization.php : 55

Locale to dump comes here before serialization.

`protected string|null $dumpLocale`

#### $dumpProperties

Serialization.php : 48

List of key to use for dump/serialization.

`protected array<string|int, string> $dumpProperties = ['date', 'timezone_type', 'timezone']`

### Methods

#### __serialize()

Serialization.php : 141

Returns the values to dump on serialize() called on.

`public __serialize() : array<string|int, mixed>`

Only used by PHP >= 7.4.

##### Return values

array<string|int, mixed>

#### __set_state()

Serialization.php : 100

The __set_state handler.

`public static __set_state(string|array<string|int, mixed> $dump) : static`

##### Parameters

$dump : string|array<string|int, mixed>

##### Return values

static

#### __sleep()

Serialization.php : 122

Returns the list of properties to dump on serialize() called on.

`public __sleep() : array<string|int, mixed>`

Only used by PHP < 7.4.

##### Return values

array<string|int, mixed>

#### __unserialize()

Serialization.php : 215

Set locale if specified on unserialize() called.

`public __unserialize(array<string|int, mixed> $data) : void`

Only used by PHP >= 7.4.

##### Parameters

$data : array<string|int, mixed>

#### __wakeup()

Serialization.php : 182

Set locale if specified on unserialize() called.

`public __wakeup() : void`

Only used by PHP < 7.4.

#### cleanupDumpProperties()

Serialization.php : 276

Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.

`public cleanupDumpProperties() : self`

foreach ($date as $_) } serializer($date) var_export($date) get_object_vars($date)

##### Return values

self

#### fromSerialized()

Serialization.php : 82

Create an instance from a serialized string.

`public static fromSerialized(string $value) : static`

##### Parameters

$value : string

##### Tags

throws
  InvalidFormatException

##### Return values

static

#### jsonSerialize()

Serialization.php : 243

Prepare the object for JSON serialization.

`public jsonSerialize() : mixed`

#### locale()

Serialization.php : 0
`public locale(string $locale = null, string $fallbackLocales) : string|static`

##### Parameters

$locale = null : string
$fallbackLocales : string

##### Return values

string|static

#### serialize()

Serialization.php : 68

Return a serialized string of the instance.

`public serialize() : string`

##### Return values

string

#### serializeUsing()

Serialization.php : 264
`public static serializeUsing(string|callable|null $format) : void`

##### Parameters

$format : string|callable|null

##### Tags

deprecated

  To avoid conflict between different third-party libraries, static setters should not be used. You should rather transform Carbon object before the serialization.

  JSON serialize all Carbon instances using the given callback.

#### toJSON()

Serialization.php : 0
`public toJSON() : string`

##### Return values

string

#### dumpTimezone()

Serialization.php : 314
`private dumpTimezone(mixed $timezone) : mixed`

##### Parameters

$timezone : mixed

#### getSleepProperties()

Serialization.php : 291
`private getSleepProperties() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

## Search results