rherb/php-odata-query-builder

OData Query Builder for PHP

Installs: 2 479

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 0

Forks: 4

Open Issues: 0

pkg:composer/rherb/php-odata-query-builder

v1.0.1 2022-12-15 05:57 UTC

This package is auto-updated.

Last update: 2025-11-18 18:13:03 UTC


README

This library is used to fluently build OData Query strings. View on Packagist.

Install the Library

You can install the PHP Library with Composer.

composer require rherb/php-odata-query-builder

To create a builder, pass in the service URL and entity set into the constructor.

$builder = new ODataQueryBuilder('http://services.odata.org/V4/TripPinService/', 'People');

Build the Query String

Use the various functions followed by the buildQuery() function to generate and return the query string.

$builder->from('People')->top(10)->buildQuery();
$builder->from('People')->find('bobjoe')->buildQuery();
$builder->from('Books')->filter('Cost')->lessThan(20)->buildQuery();
$builder->from('People')->filter('LastName')->equals('Smith')->buildQuery();
$builder->from('People')->filter('LastName')->equals('Smith')->andFilter('FirstName')->equals('Joe')->buildQuery();

Please view the test cases for more complex examples.