saintsystems / odata-client
Saint Systems OData Client for PHP
Installs: 325 867
Dependents: 1
Suggesters: 0
Security: 0
Stars: 143
Watchers: 12
Forks: 102
Open Issues: 28
Requires
- php: ^7.3 || ^8.0
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- nesbot/carbon: ^2.0 || ^3.0
Requires (Dev)
- phpunit/phpunit: ^9.0 || ^10.5
README
A fluent library for calling OData REST services inspired by and based on the Laravel Query Builder.
This library is currently in preview. Please continue to provide feedback as we iterate towards a production-supported library.
For WordPress users, please see our Gravity Forms Dynamics 365 Add-On.
Install the SDK
You can install the PHP SDK with Composer.
composer require saintsystems/odata-client
Call an OData Service
The following is an example that shows how to call an OData service.
<?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();
Develop
Run Tests
Run vendor/bin/phpunit
from the base directory.
Documentation and resources
Issues
View or log issues on the Issues tab in the repo.
Copyright and license
Copyright (c) Saint Systems, LLC. All Rights Reserved. Licensed under the MIT license.