rdrei / odata
A simple PHP OData Client
v0.0.1
2019-09-14 16:01 UTC
Requires
- php: >=7.1
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpunit/phpunit: 7.*
This package is auto-updated.
Last update: 2024-11-15 08:30:14 UTC
README
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