orajo / zf2-tus-server
Laminas (PHP) library for tus server, based on php-tus library by Simon Leblanc.
Installs: 2 796
Dependents: 1
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 9
Open Issues: 0
Requires
- php: >=7.1.0 | ^8.0
- laminas/laminas-http: ^2.5
- laminas/laminas-i18n: ^2.5
- laminas/laminas-i18n-resources: ^2.5
- laminas/laminas-json: ^3.0
- league/flysystem: ^3.0
Requires (Dev)
- phpunit/phpunit: 4.*
README
Library for tus server (tus protocol 1.0)
Installation
use composer
Server Usage
This libbrary depends on Flysystem
/** * Laminas action for uploading files */ public function uploadAction() { // Create and configure server $debug = false; // The internal adapter $adapter = new League\Flysystem\Local\LocalFilesystemAdapter( __DIR__.'/storage/' ); // The FilesystemOperator $filesystem = new League\Flysystem\Filesystem($adapter); $server = new \ZfTusServer\Server('/path/to/save/file', $this->getRequest(), $adapter $debug ); // Run server $server->process(true); }
If you are with an Apache server, add an .htaccess file to redirect all request in the php page (without that, your PATCH call failed), like :
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L]
Author
Jaroslaw Wasilewski orajo@windowslive.com.
This library is based on library (https://github.com/leblanc-simon/php-tus) by Simon Leblanc contact@leblanc-simon.eu.