Download the PHP package spazzmarticus/tus-server without Composer
On this page you can find all versions of the php package spazzmarticus/tus-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tus-server
Tus - Server
A server implementation of the "tus.io Resumable File Uploads" protocol using PSR HTTP standards.
Installation
Use composer to install:
Don't forget to install a PSR-7 and PSR-17 implementation you want to use.
PSR
Implements
- PSR-15: HTTP Server Request Handlers -
TusServer
implementsPsr\Http\Server\RequestHandlerInterface
Uses
-
PSR-3: Logger Interface - (optional) Pass a
Psr\Log\LoggerInterface
toTusServer
- PSR-7: HTTP Message Interface - An instance of
Psr\Http\Message\ServerRequestInterface
must be passed toTusServer
. -
PSR-17: HTTP Factories - Responses are created by using a
Psr\Http\Message\ResponseFactoryInterface
-
PSR-16: Simple Cache - Is used to store metadata (path to the file,
Upload-Metadata
passed by client, ... ) while uploading. [see "Cache as storage?!" below] - PSR-12: Extended Coding Style Guide - Code is written and formatted according to PSR-12.
Demo
You can demo TusServer
by installing the dev-dependencies ( composer install
) and running the provided 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:
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:
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.)
All versions of tus-server with dependencies
psr/event-dispatcher Version ^1.0
psr/http-factory Version ^1.0
psr/http-server-handler Version ^1.0
psr/log Version ^1.1|^2.0|^3.0
psr/simple-cache Version ^1.0|^2.0|^3.0
ramsey/uuid Version ^4.1