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.
You can install the PHP SDK with Composer.
{
"require": {
"saintsystems/odata-client": "0.1.*"
}
}
The following is an example that shows how to call an OData service.
use SaintSystems\OData;
class UsageExample
{
$odataServiceUrl = 'http://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
$person = $odataClient->from('People')->find('russellwhyte');
echo "Hello, I am $person->FirstName ";
// Want to only select a few properties/columns?
$people = $odataClient->from('People')->select('FirstName','LastName')->get();
}
Run vendor/bin/phpunit
from the base directory.
View or log issues on the Issues tab in the repo.
Copyright (c) Saint Systems, LLC. All Rights Reserved. Licensed under the MIT license.