libriciel/cakephp-odata 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 ODataBehavior to declare which fields and associations are exposed
  • Automatic detection of entity structure based on the schema
  • A $metadata endpoint
  • 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-only
  • 更新时间: 2025-05-15