Basic PHP Upload
<?php
// Simple file upload and transformation
require_once 'vendor/autoload.php';
use Filestack\FilestackClient;
$client = new FilestackClient('YOUR_API_KEY');
// Upload a file
$filelink = $client->upload('/path/to/image.jpg');
echo 'Uploaded: ' . $filelink->url() . "\n";
// Transform the image
$transformedFilelink = $filelink
->resize(300, 300, 'crop')
->quality(80)
->save();
echo 'Transformed: ' . $transformedFilelink->url() . "\n";Built for PHP Developers
Our PHP SDK follows PHP-FIG standards and best practices, providing a reliable, well-documented solution for all your file management needs.
PSR Compliant
Uses PSR-4 autoloading and is distributed through Composer.
Composer Ready
Easy installation via Composer with proper dependency management and semantic versioning support.
Error Handling
SDK operations throw Filestack exceptions when requests or transformations fail.
Memory Efficient
Supports standard uploads and optional Intelligent Ingestion for more resilient multipart uploads.
Legacy Support
Requires PHP 8.3 or later.
Trusted by innovative companies worldwide
Installation & Setup
Get started with our PHP SDK using Composer. Requires PHP 8.3 or later and Composer.
Composer Installation
composer require filestack/filestack-phpwget https://github.com/filestack/filestack-php/archive/master.zipdocker run --rm -v $(pwd):/app composer require filestack/filestack-php📋 Requirements
- ✓ PHP 8.3 or later
- ✓ Composer
Basic Usage
Include via Composer autoloader:
<?php
require 'vendor/autoload.php';
use Filestack\FilestackClient;
$client = new FilestackClient('YOUR_API_KEY');
Complete PHP Implementation
// Complete working example
<?php
require_once 'vendor/autoload.php';
use Filestack\FilestackClient;
$client = new FilestackClient('YOUR_API_KEY');
try {
$filelink = $client->upload('/path/to/image.jpg');
echo 'Uploaded: ' . $filelink->url() . PHP_EOL;
$transformedFilelink = $filelink
->resize(300, 300, 'crop')
->quality(80)
->save();
echo 'Transformed: ' . $transformedFilelink->url() . PHP_EOL;
} catch (\Exception $error) {
echo 'Error: ' . $error->getMessage() . PHP_EOL;
}
Integrate PHP File Processing
Join thousands of PHP developers who trust Filestack for reliable, scalable file management. From simple uploads to complex processing workflows, we’ve got you covered.