Feedple PHP SDK
Connect your relational database to Feedple AI securely through our dual-transport architecture: an autonomous stateless HTTP webhook bridge for web applications and shared hosting, or a persistent background WebSocket daemon.
Quick Installation
Install the official feedple/feedple-sdk package from Packagist:
TERMINAL
composer require feedple/feedple-sdkRequirements
- PHP:
8.0or higher (8.0,8.1,8.2,8.3,8.4+) - PDO Extension:
pdoalong with your database driver (pdo_mysql,pdo_pgsql, orpdo_sqlite) - cURL & OpenSSL: Standard PHP extensions for secure outbound HTTPS communication
- Composer: Package manager for dependency resolution
Dual-Transport Architecture
Feedple provides a flexible dual-transport architecture designed to suit both web applications / shared hosting environments and local development:
TEXT
1. Stateless HTTP Webhook (Default for Production Web & Shared Hosting)
Feedple Cloud ──[Signed HTTPS POST]──> Your App (/api/feedple/bridge) ──[Query]──> Database
(Zero background daemons, zero persistent workers, runs within standard PHP-FPM/CGI request)
2. Persistent WebSocket Daemon (Local Dev & Dedicated VPS)
Your Background Process (proc_open) ──[Outbound WSS Connection]──> Feedple Cloud
(Continuous outbound daemon with auto-reconnection and background schema polling)| Feature | Stateless HTTP Webhook (webhook) | Persistent WebSocket Daemon (websocket) |
|---|---|---|
| Best For | Web apps, APIs, Shared Hosting (cPanel), Serverless (Lambda / Bref) | Local development behind NAT, long-running CLI, Dedicated VPS |
| Process Model | Zero persistent processes; runs inside standard HTTP request | Detached background worker process (proc_open) |
| Execution Latency | ~15-30ms per query execution | Real-time streaming connection |
| System Requirements | Standard PHP-FPM / Apache / Nginx | Requires proc_open in php.ini |
| Security | Cryptographic HMAC-SHA256 signature verification | Outbound TLS connection with API key |
Tip
transport is omitted or left as default, the SDK automatically selects 'webhook' in production and 'websocket' in local development. If your application is on localhost targeting Feedple Cloud, the SDK automatically selects 'websocket' so cloud requests reach your machine without needing a public tunnel.Laravel Integration (Zero-Config Auto-Discovery)
The SDK features seamless Laravel Package Discovery. Once installed, the FeedpleServiceProvider registers automatically — no manual controller, route, or CSRF middleware configuration is required!
Step 1: Add Credentials to .env
Add your Feedple API key to your Laravel .env file:
INI
# Required: Feedple Workspace API Key
FEEDPLE_API_KEY=fdpl_live_your_actual_api_key
# Optional: Transport mode ('webhook' in production, 'websocket' in local dev)
FEEDPLE_TRANSPORT=webhook
# Optional: Bridge route path (defaults to /api/feedple/bridge)
FEEDPLE_BRIDGE_PATH=/api/feedple/bridge
# Optional: SSL Certificate verification (set false for self-signed certs or local Windows Apache)
FEEDPLE_VERIFY_SSL=trueStep 2: Sync Schema & Auto-Register Webhook Bridge
Run the built-in Artisan sync command:
TERMINAL
php artisan feedple:syncThis single command will:
- Introspect your database schema (MySQL, PostgreSQL, or SQLite).
- Auto-detect your public application URL (
APP_URL + /api/feedple/bridge). - Upload schema metadata to Feedple Cloud over HTTPS.
- Auto-register the webhook bridge URL and save the provisioned
FEEDPLE_WEBHOOK_SECRETinto your.envfile automatically.
Step 3: Artisan Commands Reference
The SDK equips your Laravel application with standard management commands:
TERMINAL
# Push schema and register/update webhook bridge URL
php artisan feedple:sync
# Force schema re-synchronization even if the local hash hasn't changed
php artisan feedple:sync --force
# Manually override the registered webhook bridge URL (e.g. for ngrok tunneling)
php artisan feedple:sync --bridge-url=https://xyz.ngrok-free.app/api/feedple/bridge
# Check SDK configuration, transport status, database connection, and recent logs
php artisan feedple:status
# Start the background WebSocket worker daemon (development mode)
php artisan feedple:start
php artisan feedple:start --tail
# Force start WebSocket daemon even if transport is configured for webhook mode
php artisan feedple:start --force
# Stop the background WebSocket daemon
php artisan feedple:stop
# (Optional) Publish configuration file for advanced customizations
php artisan vendor:publish --tag=feedple-configTip
FEEDPLE_TRANSPORT=webhook), running php artisan feedple:start will gracefully inform you that webhook mode is stateless and does not need a daemon, pointing you to php artisan feedple:sync. If you explicitly want to run a WebSocket worker anyway, pass --force.Note
APP_ENV=production), the SDK automatically upgrades public http:// bridge URLs to https://. The SDK also auto-detects public URLs across Render, Railway, Vercel, Fly.io, Heroku, and shared cPanel environments (/home/user/public_html, Apache DOCUMENT_ROOT, Nginx/FPM SERVER_NAME).Automatic Webhook Bridge Endpoint
The SDK registers the webhook route at POST /api/feedple/bridge and exempts it from CSRF verification automatically. You can verify the bridge health at any time:
TERMINAL
curl http://localhost:8000/api/feedple/bridgeJSON
{
"status": "active",
"service": "Feedple Webhook Bridge",
"transport": "webhook",
"configured": true,
"secret_set": true
}Note
FEEDPLE_TRANSPORT=webhook, the SDK hooks into Laravel's app->terminating() lifecycle. If your bridge URL hasn't been registered yet, the SDK automatically registers it with Feedple Cloud using a 24-hour cache lock, requiring zero manual cron jobs.Standalone CLI for Any PHP Project (./vendor/bin/feedple)
For non-Laravel frameworks (Symfony, WordPress, CodeIgniter, Yii) or pure PHP applications, the SDK provides an identical standalone CLI binary installed into ./vendor/bin/feedple.
The standalone CLI automatically loads your project's .env file and database credentials:
TERMINAL
# Display CLI status and connection health
./vendor/bin/feedple status
# View the last 25 lines of the SDK log file
./vendor/bin/feedple status --lines=25
# Synchronize database schema and register webhook bridge
./vendor/bin/feedple sync
# Force schema synchronization
./vendor/bin/feedple sync --force --bridge-url=https://myapp.com/feedple-bridge.php
# Start persistent WebSocket daemon (with optional live log tail)
./vendor/bin/feedple start
./vendor/bin/feedple start --tail
# Stop background WebSocket daemon
./vendor/bin/feedple stopPure PHP / Non-Laravel Webhook Bridge
In non-Laravel applications or custom microservices, create a lightweight webhook bridge entrypoint (e.g. public/feedple-bridge.php):
PHP
<?php
require __DIR__ . '/vendor/autoload.php';
use Feedple\Sdk\FeedpleSDK;
use Feedple\Sdk\DbConfig;
use Feedple\Sdk\Core\Identity;
use Feedple\Sdk\Core\WebhookBridge;
// 1. Configure database connection
$dbConfig = DbConfig::mysql(
host: getenv('DB_HOST') ?: '127.0.0.1',
database: getenv('DB_DATABASE') ?: 'myapp',
username: getenv('DB_USERNAME') ?: 'root',
password: getenv('DB_PASSWORD') ?: '',
port: (int) (getenv('DB_PORT') ?: 3306),
);
// 2. Define table access permissions (RBAC)
$identity = new Identity(name: 'production', allTables: true);
// 3. Initialize SDK in stateless webhook mode
$sdk = new FeedpleSDK(
apiKey: getenv('FEEDPLE_API_KEY'),
dbConfig: $dbConfig,
identity: $identity,
transport: 'webhook',
);
// 4. Initialize WebhookBridge with cryptographic signing secret
$bridge = new WebhookBridge(
sdk: $sdk,
webhookSecret: getenv('FEEDPLE_WEBHOOK_SECRET'),
);
// Support GET health check
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
header('Content-Type: application/json');
echo json_encode(['status' => 'active', 'service' => 'Feedple Webhook Bridge']);
exit(0);
}
// 5. Handle incoming signed query
$rawBody = file_get_contents('php://input') ?: '';
$headers = function_exists('getallheaders') ? getallheaders() : $_SERVER;
$result = $bridge->handle($rawBody, $headers);
http_response_code($result['status_code']);
header('Content-Type: application/json');
echo json_encode($result['body']);SSL Verification & CA Root Certificates
The SDK handles TLS/SSL verification out-of-the-box across all hosting environments and operating systems.
1. Bundled Mozilla CA Root Certificate
On environments where curl.cainfo or openssl.cafile is not configured in php.ini (such as local Windows XAMPP/WampServer/Apache or certain shared cPanel hosts), cURL can throw SSL certificate problem: unable to get local issuer certificate (60).
The Feedple SDK resolves this automatically by shipping with a vetted, up-to-date Mozilla CA certificate bundle at resources/cacert.pem. If no system CA file is detected, the SDK automatically applies this bundle to all outbound requests.
2. Disabling SSL Verification for Local Testing
If you are developing against a local backend or testing through self-signed certificates, you can disable SSL verification in .env:
INI
FEEDPLE_VERIFY_SSL=falseOr pass verifySsl: false directly in code:
PHP
$sdk = new FeedpleSDK(
apiKey: $apiKey,
dbConfig: $dbConfig,
identity: $identity,
verifySsl: false,
);3. Custom CA Certificate Path
If your enterprise environment routes traffic through an SSL-inspecting proxy, specify your custom CA bundle in .env:
INI
FEEDPLE_CA_BUNDLE="C:\Server\ssl\custom-ca.pem"Tip
FeedpleSDK::isValidCaFile(), preventing PHP open_basedir restriction in effect warnings on restricted cPanel and shared hosting platforms.
- Self-Healing Fallback: If OpenSSL fails to load a custom CA file stream during a connection handshake, the SDK automatically discards the problematic stream and cleanly falls back to the system's default certificate store on subsequent retries.Database Drivers & DbConfig
Configure your database connection securely using DbConfig named constructors:
PostgreSQL
PHP
$dbConfig = DbConfig::pgsql(
host: '127.0.0.1',
database: 'myapp',
username: 'postgres',
password: 'secret_password',
port: 5432,
);Note
*.supabase.co) automatically configure sslmode=require.MySQL & MariaDB
PHP
$dbConfig = DbConfig::mysql(
host: '127.0.0.1',
database: 'myapp',
username: 'root',
password: 'secret_password',
port: 3306,
charset: 'utf8mb4',
);Note
ANSI_QUOTES mode and applies dialect-aware quoting for MySQL and MariaDB queries.SQLite
PHP
$dbConfig = DbConfig::sqlite(
path: '/path/to/database.sqlite',
);Custom DSN / Escape Hatch
PHP
$dbConfig = DbConfig::raw(
dsn: 'sqlsrv:Server=localhost;Database=myapp',
username: 'sa',
password: 'Password123!',
);Important
DbConfig protects sensitive credentials using PHP 8.2 #[\SensitiveParameter]. Passwords are automatically redacted from exception backtraces, var_dump(), and error logging services.Security, RBAC & Signature Verification
Table Access Control (Identity)
Control which tables Feedple AI can query:
PHP
// Option A: Whitelist specific tables (Recommended)
$identity = new Identity(
allowedTables: ['orders', 'products', 'customers'],
);
// Option B: Allow access to all tables
$identity = new Identity(
allTables: true,
);Automatic Sensitive Column Filtering
Sensitive columns are automatically detected and omitted from schema synchronization:
password,token,secret,hash,saltssn,social_security,credit_card,cvv
Cryptographic Webhook Signatures
Every webhook request from Feedple Cloud includes an X-Feedple-Signature header:
TEXT
X-Feedple-Signature: t=1728678000,v1=5d41402abc4b2a76b9719d911017c592...- Canonical Signature:
hash_hmac('sha256', "{$timestamp}.{$rawBody}", $webhookSecret) - Replay Protection: The
WebhookBridgeverifies timestamps within a 300-second clock skew tolerance window. - Secret Rotation: Pass multiple comma-separated secrets (
"whsec_new,whsec_old") for zero-downtime key rotation.
Configuration Options
FeedpleSDK Options
| Option | Type | Default | Description | ||
|---|---|---|---|---|---|
apiKey | string | required | Your Feedple workspace API key (fdpl_live_...) | ||
dbConfig | DbConfig | required | Database configuration instance | ||
identity | Identity | required | Table access rules | ||
transport | string | 'webhook' | Transport mode: 'webhook' (stateless) or 'websocket' (daemon) | ||
webhookSecret | `string\ | null` | null | Webhook signing secret (whsec_...); auto-fetched if omitted | |
verifySsl | `bool\ | string\ | null` | true | Verify SSL certificates (false via FEEDPLE_VERIFY_SSL=false) |
caBundlePath | `string\ | null` | null | Path to custom CA bundle (FEEDPLE_CA_BUNDLE); auto-resolves bundled Mozilla certs | |
autoSync | bool | true | Automatically sync schema changes (daemon mode) | ||
syncInterval | int | 60 | Schema sync frequency in seconds (daemon mode) | ||
reconnectEnabled | bool | true | Reconnect automatically on disconnect (daemon mode) | ||
maxRetries | `int\ | null` | null | Maximum reconnect attempts (null = unlimited) | |
probeBeforeConnect | bool | false | Perform HTTP probe before WebSocket handshake | ||
runtimeDir | `string\ | null` | sys_get_temp_dir() | Directory for worker process PID and lock files | |
logger | `LoggerInterface\ | null` | null | Optional PSR-3 logger instance |
WebhookBridge Options
| Option | Type | Default | Description | |
|---|---|---|---|---|
sdk | FeedpleSDK | required | Configured FeedpleSDK instance | |
webhookSecret | `string\ | null` | null | Webhook signing secret (whsec_...); falls back to FEEDPLE_WEBHOOK_SECRET |
tolerance | int | 300 | Maximum clock skew in seconds for replay prevention |
Static Environment & Reachability Helpers (FeedpleSDK)
| Method | Return Type | Description |
|---|---|---|
isCliDevServer() | bool | Detects cli-server SAPI and php artisan serve processes |
isLocalDevTool() | bool | Detects local dev suites (Laravel Herd, Valet, Laragon, XAMPP, WAMP) |
isServerEnvironment() | bool | Detects production servers (PHP-FPM, Apache, LiteSpeed, cloud containers, cPanel) |
isDevelopment() | bool | Comprehensive development detection heuristic (APP_ENV=local, APP_DEBUG, dev tools) |
isProduction() | bool | Returns true in staging or production environments |
getDefaultTransport() | string | Returns 'webhook' in production and 'websocket' in local dev |
isWebhookReachable() | bool | Checks whether the host can accept inbound HTTP webhooks from Feedple Cloud |
detectAppUrl(?string $explicit = null) | ?string | Auto-detects public app URL (auto-upgrades http:// to https:// in production) |
detectWebhookUrl(?string $path = null, ?string $appUrl = null) | ?string | Auto-detects complete webhook bridge URL |
isValidCaFile(?string $path) | bool | open_basedir-safe check for readable, non-empty CA certificate files |
resolveCaBundle(?string $custom = null) | ?string | Resolves custom CA bundle, php.ini, Composer, or bundled Mozilla certs |
isSslVerificationEnabled() | bool | Checks if outbound SSL certificate verification is enabled |
Framework Examples
Explore ready-to-run starter projects from the official feedple-examples repository:
Previous
Why Feedple AI?
Overview & LLM Comparison
Next
TypeScript / Node.js SDK
Next.js, Express & Database Adapters
Was this page helpful?