Skip to content

r-drei/php-odata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rdrei/odata

travis-ci Latest Stable Version Total Downloads License

A small PHP OData Client based on guzzlehttp.

Install

    composer require rdrei/odata

Usage

Import the ODataClient

    use \rdrei\odata\ODataClient;
    use \rdrei\odata\ODataQuery;

Create a ODataClient and a EntityHandler.

    $client = new ODataClient([
        'url' => "https://<odata-server>/"
    ]);

    $entityHandler = $client->CreateHandler("EntityName");

Get

Get Enitities with a Query.

    $query = new ODataQuery();
    $query = $query->skip(0)->take(10);
    
    $result = $entityHandler->Get($query);

Insert

Create a new Entity.

    $entityHandler->Insert($entity);

Update

Patch a Entity.

    $entityHandler->Update($key, $entity);

Delete

Remove a Entity by Key.

    $entityHandler->Delete($key);

Run Test

    git clone ...
    composer install
    ./vendor/bin/phpunit

Documentation and Ressources