Feedple

Features

Product

Integrations

Pricing

Docs

FAQ

Contact Us

Client Login

Get Started
v1.0.30

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-sdk

Requirements

  • PHP: 8.0 or higher (8.0, 8.1, 8.2, 8.3, 8.4+)
  • PDO Extension: pdo along with your database driver (pdo_mysql, pdo_pgsql, or pdo_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)
FeatureStateless HTTP Webhook (webhook)Persistent WebSocket Daemon (websocket)
Best ForWeb apps, APIs, Shared Hosting (cPanel), Serverless (Lambda / Bref)Local development behind NAT, long-running CLI, Dedicated VPS
Process ModelZero persistent processes; runs inside standard HTTP requestDetached background worker process (proc_open)
Execution Latency~15-30ms per query executionReal-time streaming connection
System RequirementsStandard PHP-FPM / Apache / NginxRequires proc_open in php.ini
SecurityCryptographic HMAC-SHA256 signature verificationOutbound TLS connection with API key

Tip

Automatic Transport Selection: When 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=true

Step 2: Sync Schema & Auto-Register Webhook Bridge

Run the built-in Artisan sync command:

TERMINAL

php artisan feedple:sync

This single command will:

  1. Introspect your database schema (MySQL, PostgreSQL, or SQLite).
  2. Auto-detect your public application URL (APP_URL + /api/feedple/bridge).
  3. Upload schema metadata to Feedple Cloud over HTTPS.
  4. Auto-register the webhook bridge URL and save the provisioned FEEDPLE_WEBHOOK_SECRET into your .env file 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-config

Tip

Intelligent Webhook Mode Guard: If your application is configured for Webhook mode (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

Production HTTPS Auto-Upgrade & Cloud Auto-Detection: In production (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/bridge

JSON

{
  "status": "active",
  "service": "Feedple Webhook Bridge",
  "transport": "webhook",
  "configured": true,
  "secret_set": true
}

Note

Production Zero-Maintenance Auto-Registration: When running in production with 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 stop

Pure 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=false

Or 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

Host Compatibility & OpenSSL Stream Fallback: - `open_basedir` Safe: The SDK validates CA bundle filepaths safely using 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 connections (*.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

The SDK automatically enables 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, salt
  • ssn, 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 WebhookBridge verifies 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

OptionTypeDefaultDescription
apiKeystring
required
Your Feedple workspace API key (fdpl_live_...)
dbConfigDbConfig
required
Database configuration instance
identityIdentity
required
Table access rules
transportstring'webhook'Transport mode: 'webhook' (stateless) or 'websocket' (daemon)
webhookSecret`string\null`nullWebhook signing secret (whsec_...); auto-fetched if omitted
verifySsl`bool\string\null`trueVerify SSL certificates (false via FEEDPLE_VERIFY_SSL=false)
caBundlePath`string\null`nullPath to custom CA bundle (FEEDPLE_CA_BUNDLE); auto-resolves bundled Mozilla certs
autoSyncbooltrueAutomatically sync schema changes (daemon mode)
syncIntervalint60Schema sync frequency in seconds (daemon mode)
reconnectEnabledbooltrueReconnect automatically on disconnect (daemon mode)
maxRetries`int\null`nullMaximum reconnect attempts (null = unlimited)
probeBeforeConnectboolfalsePerform HTTP probe before WebSocket handshake
runtimeDir`string\null`sys_get_temp_dir()Directory for worker process PID and lock files
logger`LoggerInterface\null`nullOptional PSR-3 logger instance

WebhookBridge Options

OptionTypeDefaultDescription
sdkFeedpleSDK
required
Configured FeedpleSDK instance
webhookSecret`string\null`nullWebhook signing secret (whsec_...); falls back to FEEDPLE_WEBHOOK_SECRET
toleranceint300Maximum clock skew in seconds for replay prevention

Static Environment & Reachability Helpers (FeedpleSDK)

MethodReturn TypeDescription
isCliDevServer()boolDetects cli-server SAPI and php artisan serve processes
isLocalDevTool()boolDetects local dev suites (Laravel Herd, Valet, Laragon, XAMPP, WAMP)
isServerEnvironment()boolDetects production servers (PHP-FPM, Apache, LiteSpeed, cloud containers, cPanel)
isDevelopment()boolComprehensive development detection heuristic (APP_ENV=local, APP_DEBUG, dev tools)
isProduction()boolReturns true in staging or production environments
getDefaultTransport()stringReturns 'webhook' in production and 'websocket' in local dev
isWebhookReachable()boolChecks whether the host can accept inbound HTTP webhooks from Feedple Cloud
detectAppUrl(?string $explicit = null)?stringAuto-detects public app URL (auto-upgrades http:// to https:// in production)
detectWebhookUrl(?string $path = null, ?string $appUrl = null)?stringAuto-detects complete webhook bridge URL
isValidCaFile(?string $path)boolopen_basedir-safe check for readable, non-empty CA certificate files
resolveCaBundle(?string $custom = null)?stringResolves custom CA bundle, php.ini, Composer, or bundled Mozilla certs
isSslVerificationEnabled()boolChecks if outbound SSL certificate verification is enabled

Framework Examples

Explore ready-to-run starter projects from the official feedple-examples repository:

FrameworkGitHub SourceMode
LaravelView CodeZero-Config Auto-Discovery + Artisan Commands
SymfonyView CodeStandalone CLI + Webhook Controller
Pure PHPView CodeStandalone Bridge Script + PDO

Previous

Why Feedple AI?

Overview & LLM Comparison

Next

TypeScript / Node.js SDK

Next.js, Express & Database Adapters

Was this page helpful?

GitHubReport issue