Download the PHP package tourze/tus-upload-server-bundle without Composer
On this page you can find all versions of the php package tourze/tus-upload-server-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/tus-upload-server-bundle
More information about tourze/tus-upload-server-bundle
Files in tourze/tus-upload-server-bundle
Package tus-upload-server-bundle
Short Description TUS (Tus Resumable Upload) 文件上传服务端实现包
License MIT
Informations about the package tus-upload-server-bundle
TUS Upload Server Bundle
中文
A Symfony bundle implementing the TUS resumable upload protocol version 1.0.0.
Table of Contents
- Features
- Installation
- Configuration
- Dependencies
- Usage
- Advanced Usage
- Commands
- Services
- Events
- Testing
- Security Considerations
- License
Features
- Complete TUS 1.0.0 protocol implementation
- File storage using Flysystem (defaults to local filesystem)
- Database storage for upload metadata
- Support for upload expiration and cleanup
- Checksum validation (MD5, SHA1, SHA256)
- CORS support for browser uploads
- Configurable upload size limits
Installation
Configuration
Add the bundle to your config/bundles.php:
Configure the bundle using environment variables in your .env file:
Configure routing manually or use the controller service directly. The bundle provides a TusUploadController that can be accessed at your desired paths through your application's routing configuration.
Dependencies
This bundle requires the following dependencies:
Core Dependencies
- PHP 8.1+ - Required for modern PHP features and type declarations
- Symfony 6.4+ - Framework foundation
- Doctrine ORM 3.0+ - For database entity management
- League Flysystem 3.10+ - File storage abstraction layer
Symfony Components
symfony/config- Configuration systemsymfony/console- Command line interfacesymfony/dependency-injection- Service containersymfony/framework-bundle- Core framework bundlesymfony/http-foundation- HTTP abstractionssymfony/routing- URL routing systemsymfony/validator- Data validation
Optional Dependencies
- Redis/Memcached - For distributed locking (recommended for production)
- AWS S3/Google Cloud - For cloud file storage
- Database - MySQL, PostgreSQL, or SQLite for metadata storage
Database Setup
Create and run the migration for the Upload entity:
Usage
Endpoints
The bundle provides the following endpoints:
OPTIONS /tus/files- Get server capabilitiesPOST /tus/files- Create a new uploadHEAD /tus/files/{uploadId}- Get upload infoPATCH /tus/files/{uploadId}- Upload file chunkDELETE /tus/files/{uploadId}- Delete upload
JavaScript Client Example
TUS.js Integration
This bundle is compatible with the tus-js-client:
Advanced Usage
Custom Storage Configuration
You can configure different storage backends by implementing a custom filesystem factory:
Custom Upload Path Strategy
Implement a custom upload path strategy:
Event-Driven Processing
Handle upload events for custom processing:
Performance Optimization
For high-traffic scenarios, consider these optimizations:
1. Database Indexing
2. Caching Upload Metadata
3. Chunked Upload Optimization
Commands
Cleanup Expired Uploads
This command removes expired uploads from both the database and filesystem.
Services
TusUploadService
The main service for handling uploads:
Events
You can listen to upload events by creating event subscribers:
Testing
Run the test suite:
Security Considerations
- Configure appropriate upload size limits
- Implement authentication/authorization as needed
- Consider virus scanning for uploaded files
- Set up proper file cleanup policies
- Monitor disk usage for uploaded files
License
This bundle is released under the MIT License.
All versions of tus-upload-server-bundle with dependencies
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/doctrine-fixtures-bundle Version ^4.0
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
easycorp/easyadmin-bundle Version ^4
knplabs/knp-menu Version ^3.7
league/flysystem Version ^3.10
ramsey/uuid Version ^4.7
symfony/config Version ^7.3
symfony/console Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/framework-bundle Version ^7.4
symfony/http-foundation Version ^7.4
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/routing Version ^7.3
symfony/yaml Version ^7.3
tourze/bundle-dependency Version 1.*
tourze/doctrine-indexed-bundle Version 1.0.*
tourze/doctrine-timestamp-bundle Version 1.1.*
tourze/easy-admin-menu-bundle Version 1.0.*
tourze/file-storage-bundle Version 1.1.*
tourze/symfony-dependency-service-loader Version 1.0.*
tourze/symfony-routing-auto-loader-bundle Version 1.0.*