Serialization
Trait Serialization.
Serialization and JSON stuff.
Depends on the following properties:
Table of Contents
- $daysInMonth : int
- $month : int
- $quarter : int
- $year : int
- $dumpLocale : string|null
- Locale to dump comes here before serialization.
- $dumpProperties : array<string|int, string>
- List of key to use for dump/serialization.
- $serializer : callable|null
- The custom Carbon JSON serializer.
- __set_state() : static
- The __set_state handler.
- __sleep() : array<string|int, mixed>
- Returns the list of properties to dump on serialize() called on.
- __wakeup() : mixed
- Set locale if specified on unserialize() called.
- cleanupDumpProperties() : mixed
- 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() : array<string|int, mixed>|string
- Prepare the object for JSON serialization.
- locale() : string|static
- serialize() : string
- Return a serialized string of the instance.
- serializeUsing() : void
- toJSON() : string
Properties
$daysInMonth
public
int
$daysInMonth
$month
public
int
$month
$quarter
public
int
$quarter
Depends on the following methods:
$year
public
int
$year
$dumpLocale
Locale to dump comes here before serialization.
protected
string|null
$dumpLocale
= null
$dumpProperties
List of key to use for dump/serialization.
protected
array<string|int, string>
$dumpProperties
= ['date', 'timezone_type', 'timezone']
$serializer
The custom Carbon JSON serializer.
protected
static callable|null
$serializer
Methods
__set_state()
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()
Returns the list of properties to dump on serialize() called on.
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed> —__wakeup()
Set locale if specified on unserialize() called.
public
__wakeup() : mixed
Return values
mixed —cleanupDumpProperties()
Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.
public
cleanupDumpProperties() : mixed
foreach ($date as $_) } serializer($date) var_export($date) get_object_vars($date)
Return values
mixed —fromSerialized()
Create an instance from a serialized string.
public
static fromSerialized(string $value) : static
Parameters
- $value : string
Tags
Return values
static —jsonSerialize()
Prepare the object for JSON serialization.
public
jsonSerialize() : array<string|int, mixed>|string
Return values
array<string|int, mixed>|string —locale()
public
locale(string $locale = null) : string|static
Parameters
- $locale = null : string
Return values
string|static —serialize()
Return a serialized string of the instance.
public
serialize() : string
Return values
string —serializeUsing()
public
static serializeUsing(callable $callback) : void
Parameters
- $callback : callable
Tags
Return values
void —toJSON()
public
toJSON() : string