OData Client Library for PHP
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Fix a bug where nested where statements create invalid queries Issue #21 Nov 27, 2018
tests Fix handling of numerics in where. Fixes #20. Aug 24, 2018
.gitignore Add whereNull, whereNotNull fixes #14 Aug 24, 2018
.travis.yml Remove PHP 7.0 Aug 24, 2018
LICENSE Initial check-in. Feb 14, 2017
README.md Update readme. Aug 24, 2018
composer.json Version bump. Aug 24, 2018
phpunit.xml Initial check-in. Feb 14, 2017

README.md

Get started with the OData Client for PHP

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.

Build Status

Install the SDK

You can install the PHP SDK with Composer.

{
    "require": {
        "saintsystems/odata-client": "^0.2.4"
    }
}

Call an OData Service

The following is an example that shows how to call an OData service.

use SaintSystems\OData;

class UsageExample
{
    $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
    $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();
}

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.