PHPackages                             ejunker/filestack-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. ejunker/filestack-php

ActiveLibrary[File &amp; Storage](/categories/file-storage)

ejunker/filestack-php
=====================

A Filestack library for PHP

1.2.0(4y ago)0136↓100%1Apache-2.0PHPPHP &gt;=7.3

Since Jul 28Pushed 4y agoCompare

[ Source](https://github.com/ejunker/filestack-php)[ Packagist](https://packagist.org/packages/ejunker/filestack-php)[ RSS](/packages/ejunker-filestack-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (9)Used By (0)

[![](logo.svg)](logo.svg)

Filestack PHP
=============

[](#filestack-php)

 [ ![](https://camo.githubusercontent.com/a9e199fdf2abd14346c4f9dc6514cb145084b1dbb38fb28972ae8fc855c29491/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f66696c65737461636b2f66696c65737461636b2d7068702e737667) ](http://travis-ci.org/filestack/filestack-php) [ ![](https://camo.githubusercontent.com/dda593e1d5981994fe359fa21eee4a733a492a07c9b7f778083d961b99bbff51/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f66696c65737461636b2f66696c65737461636b2d7068702f62616467652e7376673f6272616e63683d6d6173746572) ](https://coveralls.io/github/filestack/filestack-php?branch=master) [ ![](https://camo.githubusercontent.com/042f5d85681f1a60a4a833c209ecfa75b908d316782bcee5fa0ee525c8d4ed3e/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f66696c65737461636b2f66696c65737461636b2d7068702f6261646765732f6770612e737667) ](https://codeclimate.com/github/filestack/filestack-php)

This is the official PHP SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application. Requirements
------------

[](#requirements)

- PHP 7.3+

Resources
---------

[](#resources)

- [Filestack](https://www.filestack.com)
- [Documentation](https://www.filestack.com/docs)

Installing
----------

[](#installing)

Install `filestack` with composer, either run

```
$ composer require --prefer-dist filestack/filestack-php

```

Usage
-----

[](#usage)

Filestack library gives you access to three useful classes:

- `FilestackClient` - for easy file upload (creates Filelink objects)
- `Filelink` - for file handling (downloading, converting etc.)
- `FileSecurity` - for applying policy and signature values to your API calls

### Uploading files

[](#uploading-files)

First, you need to create an instance of FilestackClient

```
use Filestack\FilestackClient;

$client = new FilestackClient('YOUR_API_KEY');
```

Call the upload() function

```
$filelink = $client->upload('/path/to/file');
```

### Storage

[](#storage)

Amazon S3 is used to store your files by default. If you wish to use a different one, you can pass in additional parameter 'location' when making upload() and store calls

```
$client = new FilestackClient('YOUR_API_KEY');
$extras = [
    'Location' => 'dropbox',
    'Filename' => 'somefilename.jpg',
];

$filepath = '/path/to/file';
$filelink = $client->upload($filepath);

# get metadata of file
$metadata = $client->getMetaData($filelink->handle, $fields);

# get content of a file
$content = $client->getContent($filelink->handle);

# download a file
$destination = '/path/to/file';
$result = $client->download($filelink->handle, $destination);

# overwrite a file
$filelink2 = $client->overwrite('/path/to/file', $filelink->handle);
```

### Manipulating files

[](#manipulating-files)

Filelink objects can be created in two ways:

- by uploading a file using FilestackClient
- by initializing Filelink with file handle and api\_key

First method was shown above, the second method is also very easy and will create objects representing files that were already uploaded.

```
use Filestack\filelink;

$filelink = new Filelink('some-file-handle', 'YOUR_API_KEY');

# transforming an image
$transformed_filelink = $filelink
            ->circle()
            ->blur(['amount' => '20'])
            ->save();

# get metadata
$metadata = $filelink->getMetaData();

# get content of a file
$content = $filelink->getContent();

$filepath = '/path/to/file';

# download a file
$filelink->download($filepath);

# overwrite remote file with local file
$filelink->overwrite($filepath);

# delete remote file
$filelink->delete();
```

### Tagging files and detecting safe for work content

[](#tagging-files-and-detecting-safe-for-work-content)

```
use Filestack\FilestackClient;
use Filestack\FilestackSecurity;

$security = new FilestackSecurity('YOUR_SECURITY_SECRET');
$client = new FilestackClient('YOUR_API_KEY', $security);

$file_handle = 'some-file-handle';

# get tags with client
$result_json = $client->getTags($file_handle);

# get tags with filelink
$filelink = new Filelink($file_handle, 'YOUR_API_KEY', $security);

$json_result = $filelink->getTags();

# get safe for work flag with client
$result_json = $client->getSafeForWork($file_handle);

# get safe for work flag with filelink
$json_result = $filelink->getSafeForWork();
```

For more examples, see the [examples/](examples/) folder in this project.

Intelligent Ingestion
---------------------

[](#intelligent-ingestion)

The Intelligent Ingestion feature allows user to upload a file in chunks of not precised size. This creates a more stable upload flow that ensures the file being uploaded will eventually complete successfully, regardless of network latency or timeout errors.

However, the upload process may be slower than the normal upload flow for large files, as there are errors are retried using the exponential backoff retry strategy.

Lastly, this feature has to be turned on for the apikey being used. To turn on this feature please contact Filestack at .

```
$client = new FilestackClient('YOUR_API_KEY');
$filelink = $client->upload('/path/to/file', ['intelligent' => true]);

```

Versioning
----------

[](#versioning)

Filestack PHP SDK follows the [Semantic Versioning](http://semver.org/).

Code Standard
-------------

[](#code-standard)

- PSR-2 coding standard ()
- PSR-4 autoloading standard ()
- phpDoc documentation comments standard ()

Testing
-------

[](#testing)

- To run tests, from the project root director, run

```
vendor/bin/phpunit

```

- To generate coverage report, run following command (will generage html files under directory coverage/)

```
vendor/bin/phpunit --coverage-xml=coverage

```

- To run PHPMD for CodeClimate checks

```
vendor/bin/phpmd filestack xml phpmd-rules.xml > logs/phpmd-report-filestack.xml
vendor/bin/phpmd tests xml phpmd-rules.xml > logs/phpmd-report-tests.xml

```

Generating documentation
------------------------

[](#generating-documentation)

To get project metrics use phar file for

```
./phploc.phar --log-xml=phploc.xml .

```

To generate documentation use phar file from

```
./phpdox.phar

```

Issues
------

[](#issues)

If you have problems, please create a [Github Issue](https://github.com/filestack/filestack-php/issues).

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

Thank you to all the [contributors](https://github.com/filestack/filestack-php/graphs/contributors).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 84.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~253 days

Recently: every ~376 days

Total

7

Last Release

1683d ago

PHP version history (2 changes)1.1.7PHP &gt;=5.6

1.2.0PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/94f5faf8e6d32349cbaf2ebf6cd84b0eb2565f44f3429950f0b06d626ef315bd?d=identicon)[ejunker](/maintainers/ejunker)

---

Top Contributors

[![hueyl77](https://avatars.githubusercontent.com/u/3211731?v=4)](https://github.com/hueyl77 "hueyl77 (179 commits)")[![kyuss](https://avatars.githubusercontent.com/u/278528?v=4)](https://github.com/kyuss "kyuss (23 commits)")[![selfsimilar](https://avatars.githubusercontent.com/u/784446?v=4)](https://github.com/selfsimilar "selfsimilar (4 commits)")[![anaxamaxan](https://avatars.githubusercontent.com/u/439457?v=4)](https://github.com/anaxamaxan "anaxamaxan (2 commits)")[![ejunker](https://avatars.githubusercontent.com/u/4758?v=4)](https://github.com/ejunker "ejunker (2 commits)")[![akalongman](https://avatars.githubusercontent.com/u/423050?v=4)](https://github.com/akalongman "akalongman (1 commits)")[![weotch](https://avatars.githubusercontent.com/u/77567?v=4)](https://github.com/weotch "weotch (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ejunker-filestack-php/health.svg)

```
[![Health](https://phpackages.com/badges/ejunker-filestack-php/health.svg)](https://phpackages.com/packages/ejunker-filestack-php)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k511.3M2.2k](/packages/aws-aws-sdk-php)[google/cloud

Google Cloud Client Library

1.2k16.2M53](/packages/google-cloud)[stechstudio/laravel-zipstream

A fast and simple streaming zip file downloader for Laravel.

4633.7M3](/packages/stechstudio-laravel-zipstream)[fof/upload

The file upload extension for the Flarum forum with insane intelligence.

188171.7k15](/packages/fof-upload)[uploadcare/uploadcare-php

Uploadcare PHP integration handles uploads and further operations with files by wrapping Upload and REST APIs.

1022.5M5](/packages/uploadcare-uploadcare-php)[azure-oss/storage

Azure Blob Storage PHP SDK

37985.0k5](/packages/azure-oss-storage)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
