Skip to content

Configuration Reference

The published configuration file is at config/odata.php.

Full configuration

php
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Route Prefix
    |--------------------------------------------------------------------------
    |
    | The URL prefix for all OData routes. All entity set, metadata, and
    | batch requests are served under this prefix.
    |
    */
    'prefix' => env('ODATA_PREFIX', 'odata'),

    /*
    |--------------------------------------------------------------------------
    | Register Routes
    |--------------------------------------------------------------------------
    |
    | Whether the package registers its own routes. Set to false when a host
    | application provides its own route group that re-uses the package's
    | routes/odata.php with its own prefix and middleware.
    |
    */
    'register_routes' => true,

    /*
    |--------------------------------------------------------------------------
    | Middleware
    |--------------------------------------------------------------------------
    |
    | Middleware applied to all OData routes. Add authentication, CORS,
    | rate limiting, or any other middleware here.
    |
    */
    'middleware' => [],

    /*
    |--------------------------------------------------------------------------
    | Streaming
    |--------------------------------------------------------------------------
    |
    | When true, JSON responses are streamed directly to the client. This
    | reduces memory usage for large result sets. When false, responses
    | are buffered in memory before sending.
    |
    */
    'streaming' => true,

    /*
    |--------------------------------------------------------------------------
    | Default Namespace
    |--------------------------------------------------------------------------
    |
    | The default XML namespace used in $metadata when a service does not
    | override namespace().
    |
    */
    'namespace' => env('ODATA_NAMESPACE', 'io.pragmatiqu'),

    /*
    |--------------------------------------------------------------------------
    | OData Version
    |--------------------------------------------------------------------------
    |
    | The OData protocol version. Currently only '4.0' is supported.
    |
    */
    'version' => env('ODATA_VERSION', '4.0'),

    /*
    |--------------------------------------------------------------------------
    | Service Registry
    |--------------------------------------------------------------------------
    |
    | The class responsible for routing incoming requests to the appropriate
    | ODataService subclass. The default serves a single service. Override
    | with a custom implementation for multi-service setups.
    |
    */
    'service_registry' => LaravelUi5\OData\ODataServiceRegistry::class,

    /*
    |--------------------------------------------------------------------------
    | Pagination
    |--------------------------------------------------------------------------
    |
    | Server-driven pagination settings.
    |
    | 'default' — page size when the client does not send a Prefer header.
    | 'max'     — upper bound that clamps the client's odata.maxpagesize
    |             preference. Set to null for no upper bound.
    |
    */
    'pagination' => [
        'max' => null,
        'default' => 200,
    ],

];

Environment variables

VariableConfig KeyDefault
ODATA_PREFIXodata.prefix'odata'
ODATA_NAMESPACEodata.namespace'com.example.odata'
ODATA_VERSIONodata.version'4.0'

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