Download the PHP package marceloeatworld/falai-php without Composer
On this page you can find all versions of the php package marceloeatworld/falai-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marceloeatworld/falai-php
More information about marceloeatworld/falai-php
Files in marceloeatworld/falai-php
Package falai-php
Short Description #1 PHP client for the fal.ai serverless AI platform, compatible with Laravel and native PHP, built on Saloon v4
License MIT
Informations about the package falai-php
fal.ai PHP Client
1 PHP client for the fal.ai serverless AI platform, compatible with Laravel and native PHP, built on Saloon v4.
Requirements
- PHP 8.2+
- ext-sodium (optional, only for webhook signature verification)
Installation
Quick Start
Queue (Async Workflow)
For long-running models, use the queue to submit jobs and retrieve results later.
Subscribe (Submit + Auto-Poll)
Submit a job and automatically poll until it completes.
Webhooks
Receive results via webhook instead of polling.
Verifying Webhook Signatures
fal.ai signs every webhook with ED25519 (X-Fal-Webhook-* headers). Verify before trusting the payload:
Public keys are fetched from the fal.ai JWKS endpoint and cached per instance, so reuse the verifier (singleton) across requests. verify() throws with a reason, isValid() returns a boolean. Timestamps older than 5 minutes are rejected.
File Upload
Upload local files to fal.ai storage for use with image-to-image models.
In-memory content works too:
Model Catalog
Search the fal.ai model catalog (no API key required for this endpoint, but one is always sent).
Pricing
Fetch unit prices and estimate costs (API key required).
Queue Options
Fine-tune queue behavior with named parameters.
Custom Base URLs
Override default endpoints if needed.
Laravel Integration
Add to config/services.php:
Register in a service provider:
Use via injection:
Error Handling
The client throws Saloon exceptions on HTTP errors (4xx/5xx). Queue subscribe throws dedicated exceptions (both extend \RuntimeException) on job failures and timeouts.
Architecture
License
MIT
Credits
- Built with Saloon v4
- fal.ai API Documentation