This is basic query builder with a fluent interface for constructing OData URL's.
It is not intended to be a full implementation but, if your needs are modest, then it could be a good fit for your project.
composer require geraint/odata-query-builder:dev-master
<?php
use ODataQueryBuilder\ODataQueryBuilder;
$serviceRootUrl = 'https://services.odata.org/V4/TripPinService/';
$resourcePath = 'People';
$builder = new ODataQueryBuilder($serviceRootUrl, $resourcePath);
$query = $builder
->filter("FirstName eq 'Scott'")
->select('UserName, LastName, FirstName')
->orderBy('LastName asc')
->format('json')
->build();
$query
should now contain the following:
https://services.odata.org/V4/TripPinService/People?$filter=FirstName%20eq%20%27Scott%27&$select=UserName%2C%20LastName%2C%20FirstName&$orderby=LastName%20asc&$format=json
See doc/methods.md for more info.
See the LICENSE file for license rights and limitations (GNU GPLv3).