PHP SDK
Add secure, scalable video to your PHP project
The FastPix PHP SDK gives you everything you need to manage video from your backend. Upload files from a public URL, attach metadata, and retrieve playback links, all without building encoding pipelines or managing storage. With this SDK, you can:
- Upload and organize video assets
- Define access control and metadata
- Generate HLS playback URLs
- Streamline video delivery from your PHP server
Find more in the SDK reference
To explore more examples, API methods, and advanced usage, see the FastPix PHP SDK on GitHub.
Prerequisites
Before you start using the SDK, make sure you have the following:
- PHP 8.2 or later: This SDK is compatible with PHP 8.2 or higher
- Composer: Required for dependency management
- cURL extension: Required for HTTP requests
- JSON extension: Required for JSON processing
- FastPix API credentials: You’ll need an Access Token and a Secret Key. You can generate these credentials by following the steps in the authentication guide
- Basic understanding of PHP and REST APIs: Familiarity with PHP development and API integration concepts
Installation
Install the SDK using Composer:
Add the SDK to your project:
Then run:
If you host the package in a private repository, add the repository to your composer.json:
Import the SDK
Example
Let’s create a file named index.php
This example shows how to upload a video from a public URL with metadata and public access:
NOTE:
In the following example, replaceyour-access-tokenandyour-secret-keywith the Access Token ID and Secret Key values from the.envfile you downloaded.
After the video is processed, you can use the media ID to fetch playback info, monitor status, or transform content through the API.
Run the example
To execute the PHP script, use the following command. Make sure to replace index.php with your actual file name if it’s different:
NOTE
Some methods might throw errors when you are on a trial plan.
Changelog
All notable changes to this project will be documented in this file.
[1.0.4]
Changed
-
SDK version bump:
1.0.3→1.0.4. A maintenance release that updates the SDK’s internal version identifiers. It contains no functional, API, or behavioral changes and is fully backward compatible with1.0.3.Updated identifiers:
sdkVersionconstant — now reports1.0.4.User-Agentheader — outbound requests now identify asfastpix-sdk/php 1.0.4.
Compatibility
- No changes to public types, method signatures, request/response models, default server URLs, hooks, or retry logic.
- No action required for existing integrations — update the dependency and rebuild.
[1.0.3]
⚠️ Important — FastPix is migrating from .io to .com
All FastPix hosts and documentation links are moving to the .com TLD:
The .io hosts continue to serve traffic during the transition, but they are slated for deprecation soon — please update any hard-coded references in your application as part of your next deploy. We strongly recommend upgrading to this SDK release (or later) across every language you use — every official FastPix SDK is being rolled out with the same migration.
What this means for users of fastpix/sdk:
- If you rely on SDK defaults, no code change is required. The default server URL is
https://api.fastpix.com/v1/, so bumping to1.0.3and runningcomposer update fastpix/sdkis enough. - If you have an explicit server-URL override (e.g.
Fastpixsdk::builder()->setServerUrl('https://api.fastpix.io/v1/')), change it tohttps://api.fastpix.com/v1/. - If you reference FastPix asset URLs directly in your app (HLS playback URLs, image CDN, dashboard deep links), update those to the
.comequivalents before.iois decommissioned.
All README and per-service doc links in this package have been updated to point at the new https://fastpix.com/docs/... URLs.
Fixed (SDK ↔ API parity)
manageVideos.listMedia(/on-demand): tracks now includeframeRate, which was being silently dropped by the previous SDK build.manageVideos.listMedia/getMedia/retrieveMediaInputInfo: audio tracks now retainlanguageCodeandlanguageName— union deserialization previously resolved every track to the video track type and discarded the language fields.playback.createMediaPlaybackId(/on-demand/{mediaId}/playback-ids): responsedata.resolutionis now correctly modelled as nullable — it isnullwhen no resolution constraint was set at create time.signingKeys.deleteSigningKey(/iam/signing-keys/{signingKeyId}): response shape now includes the optionaldata.messageconfirmation string the API has been returning.metrics.listOverallValues/metrics.getTimeseriesData: fixed a PSR-4 autoload mismatch (MetricsOverallmetadataDetails/MetricsTimeseriesmetadataDetailsfilename casing) that caused these calls to throw during deserialization.- OpenAPI
tracks[].typeforVideoTrack/VideoTrackForGetAll/AudioTrack/SubtitleTrackis now a properenum(video/audio/subtitle) so the union can be discriminated correctly. - OpenAPI
maxDuration.minimumon live-stream schemas relaxed from60to0to reflect the API’s “unbounded” sentinel value.
Docs
- All README and per-service documentation pages updated from
docs.fastpix.io/...anddocs.fastpix.com/...to the newhttps://fastpix.com/docs/...URL structure.
[1.0.2]
Fixed
- Fixed data event field remapping in hooks.
[1.0.1]
Fixed
- Fixed missing parameters in multiple API methods.
Improved
- Improved overall developer experience through more accurate typings.
[1.0.0]
Added
- Media API: Upload media assets, list, fetch, update, and delete media
- Generate and manage playback IDs
- Live API: Create, list, update, and delete live streams
- Support simulcasting to multiple platforms
- AI-powered features: video summarization, chapter generation, content moderation
- Analytics: view tracking, performance metrics, error monitoring
- Security: signing key management and JWT token support
- Playlist management: create, update, and manage playlists
- DRM configuration support
- Comprehensive error handling and retry logic
- Full PHP 8.2+ type safety with PHPStan analysis
- 163 unit and integration tests
- Complete API coverage (100% of OpenAPI specification)
[0.1.0] - Beta
Added
- Initial release of the SDK
- Basic API endpoints
- Core functionality