PHP code example of geraint / odata-query-builder

1. Go to this page and download the library: Download geraint/odata-query-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

geraint / odata-query-builder example snippets




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();