1. Go to this page and download the library: Download matatirosoln/sql-to-odata 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/ */
matatirosoln / sql-to-odata example snippets
use Matatirosoln\SqlToOdata\SqlToOdata;
$converter = new SqlToOdata();
$query = $converter->parse($sql);
use Matatirosoln\SqlToOdata\Query\SelectQuery;
$query = $converter->parse("SELECT Id, Name FROM Users WHERE Status = 'Active' ORDER BY Name ASC LIMIT 10");
// $query->entitySet => 'Users'
// $query->queryString => '?$select=Id,Name&$filter=Status eq \'Active\'&$orderby=Name asc&$top=10'
assert($query instanceof SelectQuery);