saintsystems/odata-client

Saint Systems OData 客户端 for PHP

0.7.4 2024-07-29 14:59 UTC

README

一个灵感来源于并基于 Laravel 查询构建器 的,用于调用 OData REST 服务的流畅库。

此库目前处于预览阶段。请继续提供 反馈,随着我们向生产支持的库迭代。

Build Status Latest Version on Packagist Total Downloads

对于 WordPress 用户,请参阅我们的 Gravity Forms Dynamics 365 扩展插件

安装 SDK

您可以使用 Composer 安装 PHP SDK。

composer require saintsystems/odata-client

调用 OData 服务

以下是一个展示如何调用 OData 服务的示例。

<?php

require_once __DIR__ . '/vendor/autoload.php';

use SaintSystems\OData\ODataClient;

class UsageExample
{
	public function __construct()
	{
		$odataServiceUrl = 'https://services.odata.org/V4/TripPinService';

		$odataClient = new ODataClient($odataServiceUrl);

		// Retrieve all entities from the "People" Entity Set
		$people = $odataClient->from('People')->get();

		// Or retrieve a specific entity by the Entity ID/Key
		try {
			$person = $odataClient->from('People')->find('russellwhyte');
			echo "Hello, I am $person->FirstName ";
		} catch (Exception $e) {
			echo $e->getMessage();
		}

		// Want to only select a few properties/columns?
		$people = $odataClient->from('People')->select('FirstName','LastName')->get();
	}
}

$example = new UsageExample();

开发

运行测试

从基本目录运行 vendor/bin/phpunit

文档和资源

问题

在仓库的 问题 选项卡中查看或记录问题。

版权和许可

版权(c)Saint Systems, LLC。保留所有权利。在 MIT 许可下授权。