TusPHP
A pure PHP server and client implementation of the tus resumable file-upload protocol.
Repository Health
Technical Analysis
TusPHP is a framework-agnostic PHP implementation of tus, the open HTTP-based protocol for resumable file uploads. It lets you upload large files in chunks so that a paused, dropped, or failed transfer can resume from exactly where it stopped instead of starting over, which is essential for big media, unreliable networks, and mobile clients.
The package ships both a server that handles the tus protocol handshakes and a client for sending uploads, along with pluggable caching backends, an event system, and documented integrations for Laravel, Symfony, CakePHP, and WordPress.
What You Get
- A tus-protocol Server for handling resumable upload requests
- A Client for uploading files in resumable chunks
- Pluggable cache backends (file and Redis via Predis) for upload state
- An event system for hooking into upload lifecycle stages
- Documented integrations for Laravel, Symfony, CakePHP, and WordPress
Common Use Cases
- Accepting large file uploads that can resume after interruptions
- Building reliable upload endpoints for mobile or flaky-network clients
- Handling multi-gigabyte media uploads without re-sending completed data
- Adding resumable uploads to a Laravel or Symfony application
Under The Hood
Architecture - The library is split into a Tus\Server and Tus\Client (under src/Tus), each extending a shared abstract that handles protocol headers and offsets. Incoming requests are wrapped in a Request/Response abstraction over Symfony HttpFoundation, routed through Middleware, and upload metadata is persisted via a Cache contract with file and Redis implementations. An Events subsystem built on Symfony’s event dispatcher emits lifecycle events, and a Commands namespace exposes CLI utilities for managing expired uploads.
Tech Stack - Pure PHP ^8.1 built on a stack of Symfony components (console, event-dispatcher, http-foundation, mime), Guzzle for the client’s HTTP transport, Predis for Redis-backed caching, ramsey/uuid for upload keys, and nesbot/carbon for expiry handling.
Code Quality - The project has a clear separation of concerns, a test suite run in CI, and historically tracked coverage and static analysis via Scrutinizer. Development activity has slowed (the latest release is from early 2024), but the code is mature, well-structured, and widely deployed.
API Design - The public API is small and approachable: instantiate a Server, wire it to a route, and call serve(); on the client side, point a Client at the endpoint and call upload(). Framework integration guides in the wiki reduce setup friction, and the cache/event abstractions make customization straightforward for teams that need it.