fastpix / sdk
FastPix PHP SDK for media, live streaming, playlists, analytics, and signing keys
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/fastpix/sdk
Requires
- php: >=8.2
- brick/date-time: ^0.7 || ^0.9
- brick/math: ^0.12 || ^0.14
- doctrine/instantiator: ^1.3.1 || ^2.0
- doctrine/lexer: ^2.0 || ^3.0
- galbar/jsonpath: ^3.0
- guzzlehttp/guzzle: ^7.0
- jms/metadata: ^2.6
- phpdocumentor/type-resolver: ^1.8 || ^2.0
- phpstan/phpdoc-parser: ^1.4.5 || ^2.1
Requires (Dev)
- laravel/pint: >=1.21.2
- phpstan/phpstan: >=2.1.0
- phpunit/phpunit: >=10
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2026-01-30 13:16:13 UTC
README
Developer-friendly & type-safe PHP SDK for the FastPix platform API
Introduction
The FastPix PHP SDK simplifies integration with the FastPix platform. It provides a clean, PHP 8+ interface for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, on‑demand content, playlists, video analytics, and signing keys for secure access and token management. It is intended for use with PHP 8.2 and above.
Prerequisites
Environment and Version Support
| Requirement | Version | Description |
|---|---|---|
| PHP | 8.2+ |
Core runtime environment |
| Composer | Latest |
Package manager for dependencies |
| Internet | Required |
API communication and authentication |
Pro Tip: We recommend using PHP 8.3+ for optimal performance and the latest language features.
Getting Started with FastPix
To get started with the FastPix PHP SDK, ensure you have the following:
- The FastPix APIs are authenticated using a Username and a Password. You must generate these credentials to use the SDK.
- Follow the steps in the Authentication with Basic Auth guide to obtain your credentials.
Environment Variables (Optional)
Configure your FastPix credentials using environment variables for enhanced security and convenience:
# Set your FastPix credentials export FASTPIX_USERNAME="your-access-token" export FASTPIX_PASSWORD="your-secret-key"
Security Note: Never commit your credentials to version control. Use environment variables or secure credential management systems.
Table of Contents
Setup
Installation
The SDK relies on Composer to manage its dependencies.
Add the SDK to your project:
{
"require": {
"fastpix/sdk": "*"
}
}
Then run:
composer update
If you host the package in a private repository, add the repository to your composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/your-org/fastpix-sdk-php.git"
}
],
"require": {
"fastpix/sdk": "*"
}
}
Imports
Use the SDK via Composer’s autoload and the FastPix namespaces:
<?php require 'vendor/autoload.php'; use FastPix\Sdk; use FastPix\Sdk\Models\Components; use FastPix\Sdk\Models\Operations;
Initialization
Initialize the FastPix SDK with your credentials:
<?php declare(strict_types=1); require 'vendor/autoload.php'; use FastPix\Sdk; use FastPix\Sdk\Models\Components; $sdk = Sdk\Fastpixsdk::builder() ->setSecurity( new Components\Security( username: 'your-access-token', password: 'your-secret-key', ) ) ->build();
Or using environment variables:
<?php declare(strict_types=1); require 'vendor/autoload.php'; use FastPix\Sdk; use FastPix\Sdk\Models\Components; $username = getenv('FASTPIX_USERNAME') ?: 'your-access-token'; $password = getenv('FASTPIX_PASSWORD') ?: 'your-secret-key'; $sdk = Sdk\Fastpixsdk::builder() ->setSecurity( new Components\Security( username: $username, password: $password, ) ) ->build();
Example Usage
<?php declare(strict_types=1); require 'vendor/autoload.php'; use FastPix\Sdk; use FastPix\Sdk\Models\Components; try { $sdk = Sdk\Fastpixsdk::builder() ->setSecurity( new Components\Security( username: 'your-access-token', password: 'your-secret-key', ) ) ->build(); $request = new Components\CreateMediaRequest( inputs: [ new Components\PullVideoInput(), ], metadata: [ 'key1' => 'value1', ], ); $response = $sdk->inputVideo->createMedia( request: $request ); if ($response->statusCode >= 200 && $response->statusCode < 300) { $rawBody = (string) $response->rawResponse->getBody(); $decoded = json_decode($rawBody, true); echo ($decoded !== null ? json_encode($decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : $rawBody) . "\n"; } else { $errorPayload = $response->defaultError ?? $response->error ?? null; if ($errorPayload !== null) { $errorResponse = json_decode(json_encode($errorPayload), true); echo json_encode($errorResponse, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; } else { echo json_encode(['message' => 'No response data'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; } } } catch (\Exception $e) { // Extract API error response $errorBody = null; if (property_exists($e, 'body') && property_exists($e, 'statusCode')) { $body = $e->body; $errorBody = json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { $errorBody = $body; } } elseif (method_exists($e, 'getResponse')) { $response = $e->getResponse(); if ($response !== null) { $body = (string)$response->getBody(); $errorBody = json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { $errorBody = $body; } } } // Output API error response if ($errorBody !== null) { echo json_encode($errorBody, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; } else { echo json_encode(['error' => $e->getMessage()], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; } exit(1); }
Available Resources and Operations
Comprehensive PHP SDK for FastPix platform integration with full API coverage.
Media API
Upload, manage, and transform video content with comprehensive media management capabilities.
For detailed documentation, see FastPix Video on Demand Overview.
Input Video
- Create from URL - Upload video content from external URL
- Upload from Device - Upload video files directly from device
Manage Videos
- List All Media - Retrieve complete list of all media files
- Get Media by ID - Get detailed information for specific media
- Update Media - Modify media metadata and settings
- Delete Media - Remove media files from library
- Cancel Upload - Stop ongoing media upload process
- Get Input Info - Retrieve detailed input information
- List Uploads - Get all available upload URLs
- Get Media Summary - Get summary for a media
- List Live Clips - List live clips for a livestream
Playback
- Create Playback ID - Generate secure playback identifier
- List Playback IDs - List all playback IDs for a media
- Get Playback ID - Retrieve playback configuration details
- Delete Playback ID - Remove playback access
- Update Domain Restrictions - Update domain allow/deny list for playback
- Update User Agent Restrictions - Update user-agent allow/deny list for playback
Playlist
- Create Playlist - Create new video playlist
- List Playlists - Get all available playlists
- Get Playlist - Retrieve specific playlist details
- Update Playlist - Modify playlist settings and metadata
- Delete Playlist - Remove playlist from library
- Add Media - Add media items to playlist
- Reorder Media - Change order of media in playlist
- Remove Media - Remove media from playlist
Signing Keys
- Create Key - Generate new signing key pair
- List Keys - Get all available signing keys
- Delete Key - Remove signing key from system
- Get Key - Retrieve specific signing key details
DRM Configurations
- List DRM Configs - Get all DRM configuration options
- Get DRM Config - Retrieve specific DRM configuration
Live API
Stream, manage, and transform live video content with real-time broadcasting capabilities.
For detailed documentation, see FastPix Live Stream Overview.
Start Live Stream
- Create Stream - Initialize new live streaming session with DVR mode support
Manage Live Stream
- List Streams - Retrieve all active live streams
- Get Viewer Count - Get real-time viewer statistics
- Get Stream - Retrieve detailed stream information
- Delete Stream - Terminate and remove live stream
- Update Stream - Modify stream settings and configuration
- Enable Stream - Activate live streaming
- Disable Stream - Pause live streaming
- Complete Stream - Finalize and archive stream
Live Playback
- Create Playback ID - Generate secure live playback access
- Delete Playback ID - Revoke live playback access
- Get Playback ID - Retrieve live playback configuration
Simulcast Stream
- Create Simulcast - Set up multi-platform streaming
- Delete Simulcast - Remove simulcast configuration
- Get Simulcast - Retrieve simulcast settings
- Update Simulcast - Modify simulcast parameters
Video Data API
Monitor video performance and quality with comprehensive analytics and real-time metrics.
For detailed documentation, see FastPix Video Data Overview.
Metrics
- List Breakdown Values - Get detailed breakdown of metrics by dimension
- List Overall Values - Get aggregated metric values across all content
- Get Timeseries Data - Retrieve time-based metric trends and patterns
Views
- List Video Views - Get comprehensive list of video viewing sessions
- Get View Details - Retrieve detailed information about specific video views
- List Top Content - Find your most popular and engaging content
- Get Concurrent Viewers - Monitor real-time viewer counts over time
Dimensions
- List Dimensions - Get available data dimensions for filtering and analysis
- List Filter Values - Get specific values for a particular dimension
Errors
- List Errors - List playback errors for diagnostics and monitoring
Transformations
Transform and enhance your video content with powerful AI and editing capabilities.
In-Video AI Features
Enhance video content with AI-powered features including moderation, summarization, and intelligent categorization.
- Update Summary - Create AI-generated video summaries
- Create Chapters - Automatically generate video chapter markers
- Extract Entities - Identify and extract named entities from content
- Enable Moderation - Activate content moderation and safety checks
Media Clips
- Get Media Clips - Retrieve all clips associated with a source media
Subtitles
- Generate Subtitles - Create automatic subtitles for media
Media Tracks
- Add Track - Add audio or subtitle tracks to media
- Update Track - Modify existing audio or subtitle tracks
- Delete Track - Remove audio or subtitle tracks
Access Control
- Update Source Access - Control access permissions for media source
Format Support
- Update MP4 Support - Configure MP4 download capabilities
Error Handling
All operations return a response object or throw an exception. By default, an API error will raise an Errors\APIException (or operation-specific error types).
| Property | Type | Description |
|---|---|---|
$message |
string | The error message |
$statusCode |
int | The HTTP status code |
$rawResponse |
?\Psr\Http\Message\ResponseInterface | The raw HTTP response |
$body |
string | The response content |
Example
<?php declare(strict_types=1); require 'vendor/autoload.php'; use FastPix\Sdk; use FastPix\Sdk\Models\Components; $sdk = Sdk\Fastpixsdk::builder() ->setSecurity( new Components\Security( username: 'your-access-token', password: 'your-secret-key', ) ) ->build(); try { $request = new Components\CreateMediaRequest( inputs: [new Components\PullVideoInput(url: 'https://static.fastpix.io/fp-sample-video.mp4')], metadata: ['key1' => 'value1'], ); $response = $sdk->inputVideo->createMedia(request: $request); if ($response->createMediaSuccessResponse !== null) { $rawBody = (string) $response->rawResponse->getBody(); $decoded = json_decode($rawBody, true); echo json_encode($decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); } } catch (\FastPix\Sdk\Models\Errors\APIException $e) { echo "Error: " . $e->getMessage() . "\n"; echo "Status: " . $e->statusCode . "\n"; echo "Body: " . $e->body . "\n"; }
Refer to the Errors tables in each operation’s SDK doc for possible exception types.
Server Selection
Override Server URL Per-Client
Override the default server by passing a URL when building the SDK:
<?php declare(strict_types=1); require 'vendor/autoload.php'; use FastPix\Sdk; use FastPix\Sdk\Models\Components; $sdk = Sdk\Fastpixsdk::builder() ->setServerUrl('https://api.fastpix.io/v1/') ->setSecurity( new Components\Security( username: 'your-access-token', password: 'your-secret-key', ) ) ->build();
Development
This PHP SDK is programmatically generated from our API specifications. Any manual modifications to internal files will be overwritten during subsequent generation cycles.
We value community contributions and feedback. Feel free to submit pull requests or open issues with your suggestions, and we'll do our best to include them in future releases.
Detailed Usage
For comprehensive understanding of each API's functionality, including detailed request and response specifications, parameter descriptions, and additional examples, please refer to the FastPix API Reference.
The API reference offers complete documentation for all available endpoints and features, enabling developers to integrate and leverage FastPix APIs effectively.