Installation
Requirements
- PHP 8.4 or higher
- Laravel 11.0 or higher
- PHP extensions: DOM, JSON, libxml, PDO, SimpleXML
Install via Composer
bash
composer require laravelui5/odataThe package uses Laravel's auto-discovery, so the service provider is registered automatically.
Publish the configuration
bash
php artisan vendor:publish --provider="LaravelUi5\OData\ODataServiceProvider"This creates config/odata.php with sensible defaults.
Verify the installation
Start your Laravel development server:
bash
php artisan serveVisit http://localhost:8000/odata in your browser. You should see an empty OData service document:
json
{
"@odata.context": "http://localhost:8000/odata/$metadata",
"value": []
}The service document is empty because no entity sets have been registered yet. See Quickstart to define your first service.
Configuration overview
The published config/odata.php controls:
| Key | Default | Purpose |
|---|---|---|
prefix | 'odata' | URL prefix for all OData routes |
middleware | [] | Middleware applied to OData routes |
streaming | true | Stream JSON responses (memory-efficient) |
namespace | 'com.example.odata' | Default CSDL namespace |
version | '4.0' | OData protocol version |
service_registry | ODataServiceRegistry::class | Service router class |
pagination.max | null | Maximum page size (clamps client preference) |
pagination.default | 200 | Default page size |
See Configuration Reference for full details.