class Carbon extends Carbon implements JsonSerializable (View source)

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
static protected callable|null $serializer

The custom Carbon JSON serializer.

Methods

static void
macro(string $name, object|callable $macro)

Register a custom macro.

static void
mixin(object $mixin)

Mix another object into the class.

static bool
hasMacro(string $name)

Checks if macro is registered.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

array|string
jsonSerialize()

Prepare the object for JSON serialization.

static void
serializeUsing(callable $callback)

JSON serialize all Carbon instances using the given callback.

Details

static void macro(string $name, object|callable $macro)

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin)

Mix another object into the class.

Parameters

object $mixin

Return Value

void

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

array|string jsonSerialize()

Prepare the object for JSON serialization.

Return Value

array|string

static void serializeUsing(callable $callback)

JSON serialize all Carbon instances using the given callback.

Parameters

callable $callback

Return Value

void