Vocabulary Terms
The library ships generated PHP classes for the most commonly used OData and SAP vocabulary terms.
Shipped vocabularies
| Vocabulary | Namespace | Purpose |
|---|---|---|
| Core | Org.OData.Core.V1 | Fundamental terms (Description, LongDescription, Computed) |
| Capabilities | Org.OData.Capabilities.V1 | Service capabilities (FilterRestrictions, SortRestrictions) |
| UI | com.sap.vocabularies.UI.v1 | UI rendering hints (LineItem, FieldGroup, Hidden, DisplayFormat) |
| Common | com.sap.vocabularies.Common.v1 | Common reusable terms (Label, Text, ValueList) |
| Measures | com.sap.vocabularies.Measures.v1 | Units and measures (Unit, ISOCurrency) |
| Authorization | com.sap.vocabularies.Authorization.v1 | Authorization metadata |
| Communication | com.sap.vocabularies.Communication.v1 | Communication-related terms |
| Aggregation | Org.OData.Aggregation.V1 | Data aggregation terms |
| Analytics | com.sap.vocabularies.Analytics.v1 | Analytics features |
| PersonalData | com.sap.vocabularies.PersonalData.v1 | Personal data handling |
| Validation | Org.OData.Validation.V1 | Validation rules |
Commonly used terms
Core vocabulary
| Term | Purpose |
|---|---|
Description | Human-readable description of an element |
LongDescription | Extended description |
Computed | Property value is computed by the server |
UI vocabulary
| Term | Purpose |
|---|---|
LineItem | Columns for a table display |
FieldGroup | Fields for a form display |
Hidden | Element should not be shown in UI |
DisplayFormat | How to format a value (e.g., 'Date') |
HeaderInfo | Header for an object page |
SelectionFields | Fields shown as filter bar items |
Common vocabulary
| Term | Purpose |
|---|---|
Label | Display label for a property |
Text | Human-readable text representation |
ValueList | Configuration for a value help dialog |
SemanticKey | Properties forming a human-readable key |
Capabilities vocabulary
| Term | Purpose |
|---|---|
FilterRestrictions | Which properties support filtering |
SortRestrictions | Which properties support sorting |
CountRestrictions | Whether $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:
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:
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.