libriciel/cakephp-odata
Composer 安装命令:
composer require libriciel/cakephp-odata
包简介
Provides OData integration for CakePHP with automatic field exposure, dynamic metadata, and RESTful request handling.
README 文档
README
cakephp-odata is a CakePHP plugin that enables exposing your models via the OData protocol.
It provides:
- An
ODataBehaviorto declare which fields and associations are exposed - Automatic detection of entity structure based on the schema
- A
$metadataendpoint - A component to handle RESTful OData queries
Installation
Install the plugin with Composer:
composer require libriciel/cakephp-odata
Load the plugin in Application.php (if not auto-loaded):
$this->addPlugin('CakeOData');
Usage
Enable behavior
In your table class:
$this->addBehavior('OData', [
'blackList' => ['password', 'secret_token']
]);
Fetch formatted output
$odata = $this->fetchTable('Users')->toODataValue($entity);
Access metadata
Visit: /odata/$metadata
It returns the full EDMX XML metadata for all models using ODataBehavior.
Query records
GET /odata/Users?$top=10&$skip=20
Testing
composer install
vendor/bin/phpunit
License
AGPL-3.0 © Libriciel SCOP
统计信息
- 总下载量: 266
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-only
- 更新时间: 2025-05-15