PHP SDK

Reliable File Management for PHP Applications

Build robust file handling systems with our mature PHP SDK. Perfect for Laravel, Symfony, CodeIgniter, and any PHP application requiring professional file management.
Basic PHP Upload
<?php
// Simple file upload and transformation
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
$transformation = $client->transform(
    $filelink->handle,
    ['resize' => ['width' => 300, 'height' => 300]]
);
echo "Transformed: " . $transformation->url();

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

Follows PHP-FIG standards including PSR-4 autoloading, PSR-3 logging, and PSR-7 HTTP messages for seamless integration.

Composer Ready

Easy installation via Composer with proper dependency management and semantic versioning support.

Framework Integration

Native support for Laravel, Symfony, CodeIgniter, and CakePHP with dedicated packages and service providers.

Error Handling

Comprehensive exception handling with detailed error messages, retry logic, and graceful failure recovery.

Memory Efficient

Optimized for handling large files with streaming uploads, chunked processing, and minimal memory footprint.

Legacy Support

Backward compatibility with PHP 5.6+ while supporting modern PHP 8.x features like typed properties and attributes.

Trusted by innovative companies worldwide

Installation & Setup

Get started with our PHP SDK using Composer. Compatible with PHP 5.6+ and all major frameworks.

Composer Installation

composer require filestack/filestack-php
wget https://github.com/filestack/filestack-php/archive/master.zip
docker run --rm -v $(pwd):/app composer require filestack/filestack-php
📋 Requirements
 

  1. PHP 5.6+ (PHP 8.x recommended)
  2. cURL extension
  3. JSON extension
  4. OpenSSL support
  5. mbstring extension

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

require_once 'vendor/autoload.php';

use Filestack\FilestackClient;

// Initialize the client
$client = new FilestackClient('YOUR_API_KEY');

try {
    // Upload a file
    $filelink = $client->upload('/path/to/image.jpg');
    echo "Uploaded: " . $filelink->url() . "\n";

    // Transform the image
    $transformation = $client->transform($filelink->handle, [
        'resize' => ['width' => 300, 'height' => 300],
        'quality' => 80
    ]);
    
    echo "Transformed: " . $transformation->url();
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

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.