Skip to content

Vocabulary Terms

The library ships generated PHP classes for the most commonly used OData and SAP vocabulary terms.

Shipped vocabularies

VocabularyNamespacePurpose
CoreOrg.OData.Core.V1Fundamental terms (Description, LongDescription, Computed)
CapabilitiesOrg.OData.Capabilities.V1Service capabilities (FilterRestrictions, SortRestrictions)
UIcom.sap.vocabularies.UI.v1UI rendering hints (LineItem, FieldGroup, Hidden, DisplayFormat)
Commoncom.sap.vocabularies.Common.v1Common reusable terms (Label, Text, ValueList)
Measurescom.sap.vocabularies.Measures.v1Units and measures (Unit, ISOCurrency)
Authorizationcom.sap.vocabularies.Authorization.v1Authorization metadata
Communicationcom.sap.vocabularies.Communication.v1Communication-related terms
AggregationOrg.OData.Aggregation.V1Data aggregation terms
Analyticscom.sap.vocabularies.Analytics.v1Analytics features
PersonalDatacom.sap.vocabularies.PersonalData.v1Personal data handling
ValidationOrg.OData.Validation.V1Validation rules

Commonly used terms

Core vocabulary

TermPurpose
DescriptionHuman-readable description of an element
LongDescriptionExtended description
ComputedProperty value is computed by the server

UI vocabulary

TermPurpose
LineItemColumns for a table display
FieldGroupFields for a form display
HiddenElement should not be shown in UI
DisplayFormatHow to format a value (e.g., 'Date')
HeaderInfoHeader for an object page
SelectionFieldsFields shown as filter bar items

Common vocabulary

TermPurpose
LabelDisplay label for a property
TextHuman-readable text representation
ValueListConfiguration for a value help dialog
SemanticKeyProperties forming a human-readable key

Capabilities vocabulary

TermPurpose
FilterRestrictionsWhich properties support filtering
SortRestrictionsWhich properties support sorting
CountRestrictionsWhether $count is supported

Using vocabulary classes as PHP attributes

Each vocabulary term is a PHP class that implements TypedAnnotationInterface. These classes can be used as PHP attributes on your model classes and properties. When registered via discoverModel(), ModelDiscovery reads them automatically and includes them in the $metadata output.

Class-level annotations work directly on the model class:

php
use LaravelUi5\OData\Vocabularies\Core\V1\Description;

#[Description('A flight entity')]
class Flight extends Model
{
    // ...
}

Property-level annotations require PHP 8.4 property hooks so that the declared property does not shadow Eloquent's __get() magic:

php
use LaravelUi5\OData\Vocabularies\Ui\V1\Hidden;

class Flight extends Model
{
    #[Hidden]
    public ?string $internal_code {
        get => $this->getAttribute('internal_code');
        set(?string $value) => $this->setAttribute('internal_code', $value);
    }
}

Only columns that carry vocabulary annotations need property hooks. Unannotated columns continue through Eloquent's __get() as usual.

See Applying Annotations for the full explanation and both attribute-based and programmatic approaches.

OData: MIT | Core: BSL 1.1 | SDK: Commercial License