Oihana PHP System

Appointment extends Event uses AppointmentTrait

A meeting arranged with somebody β€” or with nobody outside.

It is an Event : something that happens at a moment, in a place, with people. That is also what every calendar reads, which is why a diary needs to be taught nothing to show one.

πŸ”‘ This is the one stored shape. A visit to a customer, a meeting between colleagues, a plain diary note : one class, one collection, one set of cases. What tells a customer meeting apart is not a subclass β€” it is the stored type of its counterpart. Appointment::$about names whom the meeting is with β€” a customer, a supplier, nobody β€” and the frozen copy it holds carries its own additionalType, which is what filters, facets and guards read. A meeting requires a moment and a diary ; whether somebody sits on the other side is a fact of the meeting, not a kind of it.

πŸ”‘ One property, whatever it points at. A facet and a grouping aim at one property and one only : with a name per family, Β« how many meetings per counterpart Β» would have no answer at all. Same reason Statistics::$about carries the subject of every kind of figure.

πŸ”‘ Two axes of state, and they are not interchangeable. The one inherited from schema.org, Event::$eventStatus, says what became of the slot β€” scheduled, moved, postponed, called off β€” and publishes no member for Β« it happened Β». Appointment::$appointmentStatus says what became of the meeting : planned, done, nobody there, cancelled. A diary reads the first, a report reads the second, and a single axis could not answer both.

⚠️ What is written before, and what is written after, sit side by side. description and Appointment::$tags are the preparation ; Appointment::$report is what came of it. Neither overwrites the other β€” a meeting is worth reading precisely for the distance between the two.

Tags
author

Marc Alcaraz (eKameleon)

since
1.5.0

Table of Contents

Constants

APPOINTMENT_STATUS  : string = 'appointmentStatus'
APPOINTMENT_TYPE  : string = 'appointmentType'
CONTEXT  : string = \xyz\oihana\schema\constants\Oihana::SCHEMA
The @context of the json-ld representation of the thing.
JSON_PRIORITY_KEYS  : array<string|int, mixed> = [\org\schema\constants\Schema::AT_TYPE, \org\sc...
Defines the priority order of keys when serializing the object to JSON-LD.
MAKES_OFFER  : string = 'makesOffer'
REPORT  : string = 'report'
TAGS  : string = 'tags'

Properties

$_from  : string|null
The metadata to indicates the edge 'from' identifier.
$_id  : null|string
The metadata identifier of the item.
$_key  : null|string
The metadata unique key identifier of the thing.
$_rev  : null|string
The metadata revision value of the thing.
$_to  : string|null
The metadata to indicates the edge 'to' identifier.
$about  : null|string|object|array<string|int, mixed>
Whom the meeting is with.
$active  : bool|null
The visibility flag.
$actor  : array<string|int, mixed>|Person|PerformingGroup|null
An actor (individual or a group), e.g. in TV, radio, movie, video games etc., or in an event.
$additionalType  : array<string|int, mixed>|string|null|object
An additionalType for the item.
$aggregateRating  : array<string|int, mixed>|AggregateRating|null
The overall rating, based on a collection of reviews or ratings, of the item.
$alternateName  : string|object|array<string|int, mixed>|null
An alias for the item.
$appointmentStatus  : null|array<string|int, mixed>|string|AppointmentStatus
What became of the meeting β€” planned, done, nobody there, cancelled.
$appointmentType  : null|string|array<string|int, mixed>|DefinedTerm
What kind of meeting it is β€” on the premises, on a site, over the phone, over video.
$attendee  : null|array<string|int, mixed>|Person|Organization
Who is expected at the meeting.
$audience  : array<string|int, mixed>|Audience|null
An intended audience, i.e. a group for whom something was created. Supersedes serviceAudience.
$composer  : Person|Organization|string|null
The person or organization who wrote a composition, or who is the composer of a work performed at some event.
$contributor  : Person|Organization|string|null
A secondary contributor to the CreativeWork or Event.
$created  : null|string
Date of creation of the resource.
$date  : null|string|int
The date and time of the event or item (in ISO 8601 date format).
$description  : string|object|array<string|int, mixed>|null
A short description of the item.
$director  : Person|array<string|int, mixed>|null
A director of e.g. TV, radio, movie, video gaming etc. content, or of an event.
$disambiguatingDescription  : string|null
A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation.
$doorTime  : string|int|null
The time admission will commence.
$duration  : null|int|float|string|Duration|QuantitativeValue
The duration of the item (movie, audio recording, event, etc.) in ISO 8601 duration format.
$endDate  : null|string|int
The end date and time of the event or item (in ISO 8601 date format).
$eventAttendanceMode  : EventAttendanceModeEnumeration|DefinedTerm|string|null
The eventAttendanceMode of an event indicates whether it occurs online, offline, or a mix.
$eventSchedule  : array<string|int, mixed>|Schedule|null
Associates an Event with a Schedule.
$eventStatus  : string|DefinedTerm|EventStatusType|array<string|int, mixed>|null
An eventStatus of an event represents its status; particularly useful when an event is cancelled or rescheduled.
$funder  : array<string|int, mixed>|Organization|Person|null
A person or organization that supports (sponsors) something through some kind of financial contribution.
$funding  : string|array<string|int, mixed>|Grant|null
A Grant that directly or indirectly provide funding or sponsorship for this item.
$hasPart  : string|Thing|array<string|int, Thing>|null
Indicates an item that this part of this item.
$hasParticipationOffer  : array<string|int, mixed>|Offer|null
An offer to participate in the event, for example, Call for Proposals, Call for Speakers, or Call for Performers.
$hasSponsorshipOffer  : array<string|int, mixed>|Offer|null
An offer to sponsor the event, for example, Sponsorship Prospectus, Sponsorship Opportunities, or Sponsor Packages.
$id  : null|int|string
The unique identifier of the item.
$identifier  : string|null
The identifier of the item.
$image  : string|ImageObject|array<string|int, ImageObject|string>|null
The image reference of this resource.
$inLanguage  : array<string|int, mixed>|string|Language|null
The language of the content or performance or used in an action.
$isAccessibleForFree  : bool|null
A flag to signal that the item, event, or place is accessible for free.
$isPartOf  : string|Thing|array<string|int, Thing>|null
Indicates an item that this item is part of.
$keywords  : string|DefinedTerm|array<string|int, mixed>|null
Keywords or tags used to describe some item. Multiple textual entries in a keywords list are typically delimited by commas, or by repeating the property.
$license  : string|object|null
A legal document giving official permission to do something with the resource.
$location  : PostalAddress|Place|VirtualLocation|string|array<string|int, mixed>|null
The location of the event, organization or action.
$mainEntityOfPage  : string|null
Indicates a page (or other CreativeWork) for which this thing is the main entity being described.
$makesOffer  : null|array<string|int, mixed>|Offer
What one means to put in front of the counterpart β€” or came back with.
$maximumAttendeeCapacity  : int|null
The total number of individuals that may attend an event or venue.
$maximumPhysicalAttendeeCapacity  : int|null
The maximum physical attendee capacity of an Event whose eventAttendanceMode is OfflineEventAttendanceMode (or the offline aspects, in the case of a MixedEventAttendanceMode).
$maximumVirtualAttendeeCapacity  : int|null
The maximum virtual attendee capacity of an Event whose eventAttendanceMode is OnlineEventAttendanceMode (or the offline aspects, in the case of a MixedEventAttendanceMode).
$modified  : null|string
Date on which the resource was changed.
$name  : int|string|null
The name of the item.
$offers  : null|array<string|int, mixed>|Offer|Demand
A collection of Offer items to provide this item - for example, an offer to sell a product, rent the DVD of a movie, or give away tickets to an event.
$organizer  : null|array<string|int, mixed>|Person|Organization
Whose diary this meeting is in.
$owner  : null|string|Thing
The owner of this Thing.
$performer  : array<string|int, mixed>|null|Person|Organization
A performer at the eventβ€”for example, a presenter, musician, musical group or actor.
$photos  : array<string|int, mixed>|null
Photographs of this place (legacy spelling; see singular form, photo).
$potentialAction  : array<string|int, mixed>|Action|null
Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.
$previousStartDate  : null|string|int
Used in conjunction with eventStatus for rescheduled or cancelled events.
$publisher  : string|array<string|int, string|Person|Organization>|Person|Organization|null
The publisher of the resource.
$recordedIn  : null|array<string|int, mixed>|CreativeWork
The CreativeWork that captured all or part of this Event.
$remainingAttendeeCapacity  : null|int
The number of attendee places for an event that remain unallocated.
$remarks  : string|object|null
The remarks about the resource.
$report  : null|array<string|int, mixed>|MeetingReport
What was written once the meeting took place.
$review  : array<string|int, mixed>|Review|null
A review of the item.
$sameAs  : string|array<string|int, mixed>|null
URL of a reference Web page that unambiguously indicates the item's identity.
$sponsor  : null|array<string|int, mixed>|Organization|Person
A person or organization that supports a thing through a pledge, promise, or financial contribution.
$startDate  : null|string|int
The start date and time of the event or item (in ISO 8601 date format).
$subEvent  : Event|array<string|int, mixed>|null
An Event that is part of this event. For example, a conference event includes many presentations, each of which is a subEvent of the conference. Supersedes subEvents.
$subjectOf  : null|string|array<string|int, mixed>|CreativeWork|Event
A CreativeWork or Event about this Thing.
$superEvent  : Event|array<string|int, mixed>|null
An event that this event is a part of. For example, a collection of individual music performances might each have a music festival as their superEvent. Inverse property : subEvent.
$tags  : null|array<string|int, mixed>|string|DefinedTerm
Quick qualifiers one ticks rather than writes β€” a meal, a tour of the premises, a site visit, a demonstration.
$translator  : null|array<string|int, mixed>|Organization|Person
Organization or person who adapts a creative work to different languages, regional differences and technical requirements of a target market, or that translates during some event.
$typicalAgeRange  : string|object|null
The typical expected age range, e.g. '7-9', '11-'.
$url  : int|string|null
URL of the item.
$workFeatured  : string|array<string|int, mixed>|CreativeWork|null
A work featured in some event, e.g. exhibited in an ExhibitionEvent.
$workPerformed  : array<string|int, mixed>|CreativeWork|null
A work performed in some event, for example a play performed in a TheaterEvent.
$atContext  : string|null
The JSON-LD `@context` value.
$atType  : string|null
The JSON-LD `@type` value.
$DEFAULT_JSON_SERIALIZE_OPTIONS  : array<string|int, mixed>
The default static jsonSerialize options (class-level configuration).
$schemaTypeCache  : array<string, string>
Internal cache for resolved schema types.

Methods

__construct()  : mixed
Constructor to hydrate public properties from an array or stdClass.
getJsonSerializeOptions()  : array<string|int, mixed>
Returns the default JSON serialization options.
getSchemaType()  : string
Returns the fully qualified URI of the schema type.
jsonSerialize()  : array<string|int, mixed>
Serializes the current object into a JSON-LD array.
withAtContext()  : $this
Sets the internal JSON-LD `@context` attribute.
withAtType()  : $this
Sets the internal JSON-LD `@type` attribute.
withJSONLDMeta()  : $this
Initializes both JSON-LD metadata: `@type` and `@context`.

Constants

APPOINTMENT_STATUS

public string APPOINTMENT_STATUS = 'appointmentStatus'

CONTEXT

The @context of the json-ld representation of the thing.

public string CONTEXT = \xyz\oihana\schema\constants\Oihana::SCHEMA

JSON_PRIORITY_KEYS

Defines the priority order of keys when serializing the object to JSON-LD.

public array<string|int, mixed> JSON_PRIORITY_KEYS = [\org\schema\constants\Schema::AT_TYPE, \org\schema\constants\Schema::AT_CONTEXT, \org\schema\constants\Schema::_KEY, \org\schema\constants\Schema::_FROM, \org\schema\constants\Schema::_TO, \org\schema\constants\Schema::ID, \org\schema\constants\Schema::NAME, \org\schema\constants\Schema::URL, \org\schema\constants\Schema::CREATED, \org\schema\constants\Schema::MODIFIED]

Keys listed here will always appear first in the serialized array, in the order specified. All remaining public properties will be sorted alphabetically after these priority keys.

This ensures that important JSON-LD metadata and system fields (like @type, @context, _key, id, url, created, modified, etc.) appear at the top of the output for consistency and readability.

Usage:

$orderedKeys = self::JSON_PRIORITY_KEYS;

Notes:

  • Can be overridden in a subclass by redefining the constant.
  • Late static binding (static::JSON_PRIORITY_KEYS) allows child classes to modify the serialization order.

List of JSON-LD keys in priority order.

Properties

$_from

The metadata to indicates the edge 'from' identifier.

public string|null $_from

$_id

The metadata identifier of the item.

public null|string $_id

$_key

The metadata unique key identifier of the thing.

public null|string $_key

$_rev

The metadata revision value of the thing.

public null|string $_rev

$_to

The metadata to indicates the edge 'to' identifier.

public string|null $_to

$about

Whom the meeting is with.

public null|string|object|array<string|int, mixed> $about

Redeclares Event::$about with the same union, to name what it holds here : the counterpart of the meeting β€” a reference and a frozen copy, or a free-form value for something that is not on the books yet.

πŸ”‘ No class is named on purpose. Whom one meets is told by the value itself β€” the frozen copy carries its own additionalType β€” so hydration resolves on the stored type rather than on a declaration ; a meeting with nobody outside simply leaves it empty.

Tags
since
1.5.0

$active

The visibility flag.

public bool|null $active

$actor

An actor (individual or a group), e.g. in TV, radio, movie, video games etc., or in an event.

public array<string|int, mixed>|Person|PerformingGroup|null $actor

Actors can be associated with individual items or with a series, episode, clip.

$additionalType

An additionalType for the item.

public array<string|int, mixed>|string|null|object $additionalType

$aggregateRating

The overall rating, based on a collection of reviews or ratings, of the item.

public array<string|int, mixed>|AggregateRating|null $aggregateRating

$alternateName

An alias for the item.

public string|object|array<string|int, mixed>|null $alternateName

$appointmentStatus

What became of the meeting β€” planned, done, nobody there, cancelled.

public null|array<string|int, mixed>|string|AppointmentStatus $appointmentStatus

Reads beside Event::$eventStatus, which says what became of the slot.

Tags
since
1.5.0

$appointmentType

What kind of meeting it is β€” on the premises, on a site, over the phone, over video.

public null|string|array<string|int, mixed>|DefinedTerm $appointmentType

A term of a controlled vocabulary : a code as published, or the resolved term. One value.

⚠️ Not to be confused with the counterpart. This says what the meeting is like ; whom it is with is Appointment::$about, whose stored type is what tells a customer meeting apart.

Tags
since
1.5.0

$attendee

Who is expected at the meeting.

public null|array<string|int, mixed>|Person|Organization $attendee

Redeclares Event::$attendee with the same union. Optional, none or several β€” like an ordinary diary, where one creates the event and then invites.

πŸ”‘ No class is named here either : accounts of the house and contacts of the counterpart may sit around the same table, so each entry resolves on its own stored type.

Tags
since
1.5.0

$audience

An intended audience, i.e. a group for whom something was created. Supersedes serviceAudience.

public array<string|int, mixed>|Audience|null $audience

$composer

The person or organization who wrote a composition, or who is the composer of a work performed at some event.

public Person|Organization|string|null $composer

$contributor

A secondary contributor to the CreativeWork or Event.

public Person|Organization|string|null $contributor

$created

Date of creation of the resource.

public null|string $created

$date

The date and time of the event or item (in ISO 8601 date format).

public null|string|int $date

$description

A short description of the item.

public string|object|array<string|int, mixed>|null $description

$director

A director of e.g. TV, radio, movie, video gaming etc. content, or of an event.

public Person|array<string|int, mixed>|null $director

Directors can be associated with individual items or with a series, episode, clip.

$disambiguatingDescription

A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation.

public string|null $disambiguatingDescription

$doorTime

The time admission will commence.

public string|int|null $doorTime

$duration

The duration of the item (movie, audio recording, event, etc.) in ISO 8601 duration format.

public null|int|float|string|Duration|QuantitativeValue $duration

$endDate

The end date and time of the event or item (in ISO 8601 date format).

public null|string|int $endDate

$eventSchedule

Associates an Event with a Schedule.

public array<string|int, mixed>|Schedule|null $eventSchedule

There are circumstances where it is preferable to share a schedule for a series of repeating events rather than data on the individual events themselves. For example, a website or application might prefer to publish a schedule for a weekly gym class rather than provide data on every event. A schedule could be processed by applications to add forthcoming events to a calendar. An Event that is associated with a Schedule using this property should not have startDate or endDate properties. These are instead defined within the associated Schedule, this avoids any ambiguity for clients using the data. The property might have repeated values to specify different schedules, e.g. for different months or seasons.

$eventStatus

An eventStatus of an event represents its status; particularly useful when an event is cancelled or rescheduled.

public string|DefinedTerm|EventStatusType|array<string|int, mixed>|null $eventStatus

$funder

A person or organization that supports (sponsors) something through some kind of financial contribution.

public array<string|int, mixed>|Organization|Person|null $funder

$funding

A Grant that directly or indirectly provide funding or sponsorship for this item.

public string|array<string|int, mixed>|Grant|null $funding

$hasPart

Indicates an item that this part of this item.

public string|Thing|array<string|int, Thing>|null $hasPart

$hasParticipationOffer

An offer to participate in the event, for example, Call for Proposals, Call for Speakers, or Call for Performers.

public array<string|int, mixed>|Offer|null $hasParticipationOffer

$hasSponsorshipOffer

An offer to sponsor the event, for example, Sponsorship Prospectus, Sponsorship Opportunities, or Sponsor Packages.

public array<string|int, mixed>|Offer|null $hasSponsorshipOffer

$id

The unique identifier of the item.

public null|int|string $id

$identifier

The identifier of the item.

public string|null $identifier

$inLanguage

The language of the content or performance or used in an action.

public array<string|int, mixed>|string|Language|null $inLanguage

Please use one of the language codes from the IETF BCP 47 standard.

Tags
see
IETF

BCP 47 : http://tools.ietf.org/html/bcp47

$isAccessibleForFree

A flag to signal that the item, event, or place is accessible for free.

public bool|null $isAccessibleForFree

$isPartOf

Indicates an item that this item is part of.

public string|Thing|array<string|int, Thing>|null $isPartOf

$keywords

Keywords or tags used to describe some item. Multiple textual entries in a keywords list are typically delimited by commas, or by repeating the property.

public string|DefinedTerm|array<string|int, mixed>|null $keywords

$license

A legal document giving official permission to do something with the resource.

public string|object|null $license

$mainEntityOfPage

Indicates a page (or other CreativeWork) for which this thing is the main entity being described.

public string|null $mainEntityOfPage

$makesOffer

What one means to put in front of the counterpart β€” or came back with.

public null|array<string|int, mixed>|Offer $makesOffer

Each entry wraps one product in an Offer : itemOffered names the product, description says what to do with it, and the price properties are there the day an intention becomes a figure β€” a discount considered, a quantity worth quoting. Reuses the name and the meaning Organization::$makesOffer already carries.

Absent when there is nothing to present β€” which is most meetings, and every plain diary note.

Tags
since
1.5.0
Attributes
#[HydrateWith]
\org\schema\Offer::class

$maximumAttendeeCapacity

The total number of individuals that may attend an event or venue.

public int|null $maximumAttendeeCapacity

Supersedes capacity. Supersedes $numAttendee.

$maximumPhysicalAttendeeCapacity

The maximum physical attendee capacity of an Event whose eventAttendanceMode is OfflineEventAttendanceMode (or the offline aspects, in the case of a MixedEventAttendanceMode).

public int|null $maximumPhysicalAttendeeCapacity

$maximumVirtualAttendeeCapacity

The maximum virtual attendee capacity of an Event whose eventAttendanceMode is OnlineEventAttendanceMode (or the offline aspects, in the case of a MixedEventAttendanceMode).

public int|null $maximumVirtualAttendeeCapacity

$modified

Date on which the resource was changed.

public null|string $modified

$name

The name of the item.

public int|string|null $name

$offers

A collection of Offer items to provide this item - for example, an offer to sell a product, rent the DVD of a movie, or give away tickets to an event.

public null|array<string|int, mixed>|Offer|Demand $offers

$organizer

Whose diary this meeting is in.

public null|array<string|int, mixed>|Person|Organization $organizer

Redeclares Event::$organizer with the same union, to name the subject : a stored row is read back as a User.

πŸ”‘ The account, not the business role. A diary belongs to a person, and a person may hold more than one role over time β€” a salesperson who also becomes a sales manager keeps one diary and one set of hours. Hanging the meeting on the role would mean merging two diaries the day the second one is granted.

Not necessarily whoever entered it, either : an assistant books meetings for someone else's diary, and it is the diary that matters here.

Tags
since
1.5.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\auth\User::class

$owner

The owner of this Thing.

public null|string|Thing $owner

Represents any entity (person, organization, system, or other object) that can be considered the possessor of this Thing.

$performer

A performer at the eventβ€”for example, a presenter, musician, musical group or actor.

public array<string|int, mixed>|null|Person|Organization $performer

$photos

Photographs of this place (legacy spelling; see singular form, photo).

public array<string|int, mixed>|null $photos

$potentialAction

Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.

public array<string|int, mixed>|Action|null $potentialAction

$previousStartDate

Used in conjunction with eventStatus for rescheduled or cancelled events.

public null|string|int $previousStartDate

This property contains the previously scheduled start date.

$recordedIn

The CreativeWork that captured all or part of this Event.

public null|array<string|int, mixed>|CreativeWork $recordedIn

$remainingAttendeeCapacity

The number of attendee places for an event that remain unallocated.

public null|int $remainingAttendeeCapacity

$remarks

The remarks about the resource.

public string|object|null $remarks

$report

What was written once the meeting took place.

public null|array<string|int, mixed>|MeetingReport $report

One report, absent until there is something to report. The report carries its own stored type, and a write-up that says more than the common cases β€” a visit's β€” resolves to its richer class from the value itself.

Tags
since
1.5.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\appointments\MeetingReport::class

$review

A review of the item.

public array<string|int, mixed>|Review|null $review

$sameAs

URL of a reference Web page that unambiguously indicates the item's identity.

public string|array<string|int, mixed>|null $sameAs

E.g. the URL of the item's Wikipedia page, Wikidata entry, or official website.

$sponsor

A person or organization that supports a thing through a pledge, promise, or financial contribution.

public null|array<string|int, mixed>|Organization|Person $sponsor

$startDate

The start date and time of the event or item (in ISO 8601 date format).

public null|string|int $startDate

$subEvent

An Event that is part of this event. For example, a conference event includes many presentations, each of which is a subEvent of the conference. Supersedes subEvents.

public Event|array<string|int, mixed>|null $subEvent

$subjectOf

A CreativeWork or Event about this Thing.

public null|string|array<string|int, mixed>|CreativeWork|Event $subjectOf

$superEvent

An event that this event is a part of. For example, a collection of individual music performances might each have a music festival as their superEvent. Inverse property : subEvent.

public Event|array<string|int, mixed>|null $superEvent

$tags

Quick qualifiers one ticks rather than writes β€” a meal, a tour of the premises, a site visit, a demonstration.

public null|array<string|int, mixed>|string|DefinedTerm $tags

Terms of a controlled vocabulary : codes as published, or resolved terms. Several. True of the meeting whether they were planned or observed, which is why they live here and not on the report.

Tags
since
1.5.0

$translator

Organization or person who adapts a creative work to different languages, regional differences and technical requirements of a target market, or that translates during some event.

public null|array<string|int, mixed>|Organization|Person $translator

$typicalAgeRange

The typical expected age range, e.g. '7-9', '11-'.

public string|object|null $typicalAgeRange

$url

URL of the item.

public int|string|null $url

$workFeatured

A work featured in some event, e.g. exhibited in an ExhibitionEvent.

public string|array<string|int, mixed>|CreativeWork|null $workFeatured

$workPerformed

A work performed in some event, for example a play performed in a TheaterEvent.

public array<string|int, mixed>|CreativeWork|null $workPerformed

$atContext

The JSON-LD `@context` value.

protected string|null $atContext = null

Default is https://schema.org.

$atType

The JSON-LD `@type` value.

protected string|null $atType = null

This can be manually set or automatically inferred from the class name.

$DEFAULT_JSON_SERIALIZE_OPTIONS

The default static jsonSerialize options (class-level configuration).

protected static array<string|int, mixed> $DEFAULT_JSON_SERIALIZE_OPTIONS = []

$schemaTypeCache

Internal cache for resolved schema types.

private static array<string, string> $schemaTypeCache = []

Methods

__construct()

Constructor to hydrate public properties from an array or stdClass.

public __construct([array<string|int, mixed>|object|null $init = null ]) : mixed

This allows objects to be quickly populated with associative data without manually setting each property.

Parameters
$init : array<string|int, mixed>|object|null = null

A data array or object used to initialize the instance. Keys must match public property names.

Tags
throws
ReflectionException
example
use org\schema\Person;
use org\schema\constants\Prop;

$person = new Person
([
    Prop::NAME => 'Jane Doe',
    Prop::URL  => 'https://example.com/janedoe'
]);

echo $person->name; // Outputs: Jane Doe

getJsonSerializeOptions()

Returns the default JSON serialization options.

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

This method determines how the jsonSerialize() output is reduced or compressed, etc. It can be overridden in child classes to customize serialization behavior.

Return values
array<string|int, mixed>

Returns the reduction/compression options for JSON serialization.

getSchemaType()

Returns the fully qualified URI of the schema type.

public static getSchemaType() : string

This method combines the class's CONTEXT constant with its short name to produce a globally unique identifier for the entity type.

  • It uses Late Static Binding to ensure the correct context is retrieved even when called from an inherited class (e.g., Corporation vs. Affiliate).
  • Performance Optimization: Results are stored in a static cache ($schemaTypeCache) to avoid redundant Reflection calls during the same execution lifecycle.
Return values
string

The absolute URI of the type (e.g., "https://schema.org/Thing"). ** @example

echo Thing::getSchemaType();      // https://schema.org/Thing
echo Affiliate::getSchemaType();  // https://schema.oihana.xyz/Pagination

jsonSerialize()

Serializes the current object into a JSON-LD array.

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

Includes public properties, the JSON-LD @context and @type. Null values are automatically removed.

Tags
throws
ReflectionException

If reflection fails when accessing properties.

example
use org\schema\Person;
use org\schema\constants\Prop;

$person = new Person
([
    Prop::NAME => 'John Smith',
    Prop::ID   => 'jsmith-001'
]);

echo json_encode($person, JSON_PRETTY_PRINT);

Output:

{
   "@type": "Person",
   "@context": "https://schema.org",
   "id": "jsmith-001",
   "name": "John Smith"
}
Return values
array<string|int, mixed>

JSON-LD representation of the object.

withAtContext()

Sets the internal JSON-LD `@context` attribute.

public withAtContext(string $context) : $this

Useful if you need a custom JSON-LD context.

Parameters
$context : string

Optional JSON-LD context.

Return values
$this

withAtType()

Sets the internal JSON-LD `@type` attribute.

public withAtType(string $type) : $this

Allows overriding the default type inferred from the class.

Parameters
$type : string

Optional JSON-LD type

Return values
$this

withJSONLDMeta()

Initializes both JSON-LD metadata: `@type` and `@context`.

public withJSONLDMeta([string|null $atType = null ][, string|null $atContext = null ]) : $this

Can be called from constructor or later to override default values.

Parameters
$atType : string|null = null

Optional JSON-LD type

$atContext : string|null = null

Optional JSON-LD context

Return values
$this
On this page

Search results