1. Go to this page and download the library: Download wpdev/odata-feed 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/ */
wpdev / odata-feed example snippets
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use WPDev\ODataFeed\Feed\FeedConfig;
use WPDev\ODataFeed\Writer\LiveXlsxWriter;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('Sales');
$sheet->fromArray(['Product', 'Amount'], null, 'A1');
$sheet->fromArray(['Widget', 10], null, 'A2');
$writer = new LiveXlsxWriter($spreadsheet);
$writer->setFeed(new FeedConfig(
'https://api.example.com/odata', // OData base URL
'abc123', // feed id (path segment)
'Sales' // entity set / sheet name
));
$writer->save('output.xlsx');