orajo / zf2-tus-server
Laminas (PHP)库,用于tus服务器,基于Simon Leblanc的php-tus库。
v3.0.5
2024-01-03 11:26 UTC
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
tus服务器 (tus协议1.0)库
安装
使用composer
服务器使用
此库依赖于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); }
如果你使用的是Apache服务器,添加一个.htaccess文件以重定向PHP页面上的所有请求(如果没有,你的PATCH调用将失败),如下所示
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L]
作者
Jaroslaw Wasilewski orajo@windowslive.com。
此库基于Simon Leblanc的库(https://github.com/leblanc-simon/php-tus)contact@leblanc-simon.eu。