Download the PHP package wpdev/phpspreadsheet-odata without Composer
On this page you can find all versions of the php package wpdev/phpspreadsheet-odata. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wpdev/phpspreadsheet-odata
More information about wpdev/phpspreadsheet-odata
Files in wpdev/phpspreadsheet-odata
Package phpspreadsheet-odata
Short Description Framework-agnostic OData v4 read-only feed for PhpSpreadsheet workbooks
License MIT
Informations about the package phpspreadsheet-odata
phpspreadsheet-odata
Framework-agnostic OData v4 read-only feed for PhpSpreadsheet workbooks.
Each worksheet becomes an OData entity set. The first row defines property names; remaining rows are exposed as entities with a synthetic RowIndex key.
Requirements
- PHP >= 7.4
- Composer
Installation
Quick Start
Run the included example:
Then open:
- Feed index:
http://localhost:8080/odata - Metadata:
http://localhost:8080/odata/employees/$metadata - Entity set:
http://localhost:8080/odata/employees/Employees - Single entity:
http://localhost:8080/odata/employees/Employees(1)
Supported Endpoints
Single feed (Phase 1 — backward compatible)
Pass a Spreadsheet directly to ODataServer:
| Method | Path | Description |
|---|---|---|
GET |
/ |
OData service document (JSON) |
GET |
/$metadata |
EDMX metadata (XML) |
GET |
/{SheetName} |
Entity collection |
GET |
/{SheetName}({key}) |
Single entity by RowIndex |
Multi-feed / multi-tenant (Phase 2)
Inject a FeedResolverInterface to serve many feeds from one endpoint:
| Method | Path | Description |
|---|---|---|
GET |
/ |
Lists registered feed IDs |
GET |
/{feedId}/$metadata |
EDMX metadata for that feed |
GET |
/{feedId}/{SheetName} |
Entity collection |
GET |
/{feedId}/{SheetName}({key}) |
Single entity by RowIndex |
feedId must be URL-safe ([A-Za-z0-9_-]+).
Feed Resolution
The core package is database-agnostic. Provide a FeedResolverInterface to map feedId → Spreadsheet:
Optional PDO-backed resolver
For database-backed feeds, use PdoFeedResolver with an injected PDO and a loader callback. The resolver only looks up a source_ref — loading the spreadsheet is your responsibility:
Authentication is checked before feed resolution: invalid auth → 401; valid auth + unknown feedId → 404.
Query Options
| Option | Example |
|---|---|
$filter |
?$filter=Name eq 'Alice' |
$select |
?$select=Name,Age |
$top |
?$top=10 |
$skip |
?$skip=20 |
$count |
?$count=true |
$orderby |
?$orderby=Age desc |
Supported filter operators: eq, ne, gt, lt, ge, le. Multiple conditions can be combined with and.
Authentication
Invalid or missing credentials return 401 Unauthorized with a WWW-Authenticate challenge header (Basic realm="OData" or Bearer realm="OData").
Excel credential prompt
When paired with wpdev/odata-feed, the workbook stores only the OData URL — no password in the file. On Data → Refresh All, Power Query requests $metadata first; a 401 with WWW-Authenticate: Basic triggers Excel's native username/password dialog. Credentials are saved in the OS credential store (Keychain on macOS), keyed by the data source URL.
If a feed was previously refreshed anonymously, clear or edit stored credentials via Data → Get Data → Data Source Settings → Edit Permissions.
Use HTTPS in production when enabling Basic auth.
Architecture
ODataServer— main PSR-7 entry pointFeedResolverInterface— resolvesfeedIdto aSpreadsheetInMemoryFeedResolver— array-backed resolver for tests and small setupsPdoFeedResolver— optional PDO example for DB-backed feed lookupEntitySetBuilder— maps worksheets to entitiesMetadataBuilder— generates$metadataEDMXQueryProcessor— applies OData query optionsResponseFormatter— formats OData JSON responsesRouter— routes requests to handlers (with optionalfeedIdsegment)
Production deployment
- Set
serviceRootto the public URL of your OData endpoint (no trailing slash required). - Enable authentication before exposing feeds to the internet.
- Use HTTPS via your web server or reverse proxy.
- For multi-tenant setups, implement
FeedResolverInterfaceto load workbooks from your storage layer. - Query limits are enforced:
$top≤ 1000,$skip≤ 100000.
Development
License
GNU General Public License v2.0 or later — see LICENSE.
All versions of phpspreadsheet-odata with dependencies
phpoffice/phpspreadsheet Version ^1.29
psr/http-message Version ^1.0|^2.0
guzzlehttp/psr7 Version ^2.0