定制 spazzmarticus/tus-server 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

spazzmarticus/tus-server

最新稳定版本:2.1.0-rc1

Composer 安装命令:

composer require spazzmarticus/tus-server

包简介

Tus.io-protocol server implementation using PSR standards

README 文档

README

A server implementation of the "tus.io Resumable File Uploads" protocol using PSR HTTP standards.

Installation

Use composer to install:

composer require spazzmarticus/tus-server

Don't forget to install a PSR-7 and PSR-17 implementation you want to use.

PSR

Implements

Uses

Demo

You can demo TusServer by installing the dev-dependencies ( composer install ) and running the provided server.php :

php -S localhost:8000 example/server.php

Open your browser, surf to localhost:8000/ and use (Uppy) to upload.

Uploads are stored at example/uploads/... , the filesystem cache is at example/cache/ .

Surf to localhost:8000/reset to permanently delete uploads, intermediate chunks and the metadata-storage. There might be an error log at example/log/php-error.php and a server log at example/log/tus-server.log containing some additional information.

Test

Automated testing is done with:

  • PHPUnit - unit- and integration-tests
  • newman - Verify TusServer meets the tus. io-protocol.

Examples

  • Slim v4 - Slim routes allow to directly call this tus-server implementation.

👋 This is how I use tus-server.

Cache as storage?!

TusServer needs something fast to store metadata about uploads. Since the payload is small and performance is important, caches can be used.

Instead of using a volatile cache only, you should use a chain containing both a fast volatile and a slower non-volatile cache. (Losing the metadata mid-upload does not allow for resuming uploads. )

👋 I use symfony/cache:

 $volatileCache = new Symfony\Component\Cache\Adapter\ApcuAdapter('...');
 $nonVolatileCache = new Symfony\Component\Cache\Adapter\FilesystemAdapter('', 0, __DIR__ . '/...');

 $cacheChain = new Symfony\Component\Cache\Adapter\ChainAdapter([$volatileCache, $nonVolatileCache]);

 $storage = new Symfony\Component\Cache\Psr16Cache($cacheChain);

Alternatives

  • ankitpokhrel/tus-php - Did not provide enough flexibility for my needs and is the reason I decided to start my own implementation. (Provides a php tus-client, if you are looking for that.)

统计信息

  • 总下载量: 16.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2020-03-10