All Projects → filestack → filestack-php

filestack / filestack-php

Licence: Apache-2.0 license
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.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to filestack-php

uploadcare client
A flutter library for working with Uploadcare REST API. File uploads, media processing, and adaptive delivery for web and mobile.
Stars: ✭ 14 (-72%)
Mutual labels:  upload-file, upload-images
AndroidFlask
Image Upload from Android to Python-Based Flask Server
Stars: ✭ 45 (-10%)
Mutual labels:  upload-file, upload-images
Django-WebApp
This is a web-app created using Python, Django. By using this user can login, upload files and also can view and download files uploaded by other users.
Stars: ✭ 285 (+470%)
Mutual labels:  upload-file, upload-images
rustypaste
A minimal file upload/pastebin service.
Stars: ✭ 102 (+104%)
Mutual labels:  upload-file, upload-images
google-music-manager-uploader
Google Music Manager Uploader module / Easily upload MP3 (folder) to Google Music
Stars: ✭ 21 (-58%)
Mutual labels:  upload-file
react-native-tus-client
React Native client for the tus resumable upload protocol.
Stars: ✭ 38 (-24%)
Mutual labels:  upload-file
nodejs-simple-file-upload
a simple app for uploading files using node.js and express
Stars: ✭ 24 (-52%)
Mutual labels:  upload-file
react-hooks-file-upload
React Hooks File Upload example with Progress Bar using Axios, Bootstrap
Stars: ✭ 30 (-40%)
Mutual labels:  upload-file
ngx-image-compress
Angular library for uploading and compressing images
Stars: ✭ 65 (+30%)
Mutual labels:  upload-images
ImagerJs
A JavaScript library for uploading images using drag & drop. Crop, rotate, resize, or shrink your image before uploading.
Stars: ✭ 101 (+102%)
Mutual labels:  upload-images
v-editor
📝Write md or rich text easily
Stars: ✭ 22 (-56%)
Mutual labels:  upload-images
tiny-qiniu-request
tiny-qiniu for rc-upload or antd upload component `customRequest` property
Stars: ✭ 13 (-74%)
Mutual labels:  upload-file
RxUploader
Uploader for Android using RxJava
Stars: ✭ 72 (+44%)
Mutual labels:  upload-file
spring-boot-upload-file-lead-to-rce-tricks
spring boot Fat Jar 任意写文件漏洞到稳定 RCE 利用技巧
Stars: ✭ 517 (+934%)
Mutual labels:  upload-file
MLH-Quizzet
This is a smart Quiz Generator that generates a dynamic quiz from any uploaded text/PDF document using NLP. This can be used for self-analysis, question paper generation, and evaluation, thus reducing human effort.
Stars: ✭ 23 (-54%)
Mutual labels:  upload-file
eosfilestore-web
📜🔗 EOSfilestore, Immutable, time-proof, file storage on EOS blockchain
Stars: ✭ 20 (-60%)
Mutual labels:  upload-file
typeplate
REST API boilerplate with Typescript, Express.js, Typeorm and Mocha.
Stars: ✭ 268 (+436%)
Mutual labels:  upload-file
filestack-ios
Official iOS 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.
Stars: ✭ 44 (-12%)
Mutual labels:  filestack
google-photos-upload
Upload a local image directory into an Album in Google Photos (works on mac/pc/linux). Coded in C# .NET Core 3.0
Stars: ✭ 26 (-48%)
Mutual labels:  upload-images
vue2-multi-uploader
Drag and drop multiple file uploader with Vue.js v2 and Axios
Stars: ✭ 46 (-8%)
Mutual labels:  upload-images

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

  • PHP 7.3+

Resources

Installing

Install filestack with composer, either run

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

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

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

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

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

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/ folder in this project.

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 [email protected].

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

Versioning

Filestack PHP SDK follows the Semantic Versioning.

Code Standard

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

To get project metrics use phar file for https://github.com/sebastianbergmann/phploc

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

To generate documentation use phar file from https://github.com/theseer/phpdox

./phpdox.phar

Issues

If you have problems, please create a Github Issue.

Contributing

Please see CONTRIBUTING.md for details.

Credits

Thank you to all the contributors.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].