This example demonstrates how to use the Tinybird SDK for PHP with Forward workspaces.
| Method | Endpoint | Description |
|---|---|---|
dataSources()->list() |
GET /v?/datasources |
List all Data Sources |
dataSources()->retrieve() |
GET /v?/datasources/{name} |
Get a specific Data Source |
events()->send() |
POST /v?/events |
Send events (recommended for ingestion) |
cd examples/datasources
composer installcp env.example .envEdit .env and add your Tinybird token:
TINYBIRD_TOKEN=p.your_token_hereGet your token from https://app.tinybird.co/tokens or use tb token ls for Tinybird Local.
For Tinybird Local or Cloud, deploy the Data Source:
cd tinybird
tb deployThis creates the sdk_test_events Data Source with NDJSON schema:
timestamp DateTime `json:$.timestamp`
event String `json:$.event`
user_id String `json:$.user_id`
properties String `json:$.properties`
php index.php╔══════════════════════════════════════════════════════════════╗
║ Tinybird SDK PHP - Forward Workflow Examples ║
╚══════════════════════════════════════════════════════════════╝
[INFO] Connecting to Tinybird Local (localhost:7181)
============================================================
1. GET /v?/datasources - List Data Sources
============================================================
[INFO] Found 1 Data Source(s):
- sdk_test_events (rows: 0, bytes: 0)
[OK] Listed Data Sources successfully.
============================================================
2. GET /v?/datasources/{name} - Retrieve Data Source
============================================================
[INFO] Retrieving: sdk_test_events
ID: t_28c2a193c3304ed9a3b0a86fdf2cdd11
Name: sdk_test_events
Type: ndjson
Rows: 0
Bytes: 0
Created: 2025-12-11 08:38:34
Columns:
- timestamp: DateTime
- event: String
- user_id: String
- properties: String
[OK] Retrieved Data Source successfully.
============================================================
3. POST /v?/events - Send Events (recommended for Forward)
============================================================
[INFO] Sending events to: sdk_test_events
Rows ingested: 3
Quarantined: 0
[OK] Events sent successfully.
[INFO] Verifying ingestion...
Data Source now has 3 rows
[OK] Events API works!
============================================================
Examples Completed Successfully!
============================================================
In Tinybird Forward, the recommended workflow is:
- Define schemas in
.datasourcefiles - Deploy with
tb deploy - Ingest data via Events API (
$client->events()->send()) - Query via SQL or Pipe endpoints