PSR-7 compatible tus server for PHP
Stores files in S3
$storage = new Tusk\Storage\S3Storage(new Aws\S3\S3Client([
'version' => '2006-03-01',
'region' => 'eu-west-1',
]), 'bucket-name');See the documentation for PHP AWS SDK for more information.
By default, file IDs are created using the RandomHexIdGenerator, which should give you 32-character IDs that look like 69ed96b70ab30c8f046e79b74faf481b.
If you'd like to change how this works, you can inject a custom class that implements IdGenerator.
When a file upload begins, the server returns a URL that the client can continue to send data to.
By default this is whatever the POST URL is, plus the file ID.
This is handled by the RelativeLocationGenerator.
For example, if the POST endpoint's URL was /files, the file location would be files/<id>.
If you'd like to change this, you can inject a custom class that implements LocationGenerator.
Tusk emits events when certain things happen during a file's lifecycle. You can hook into these with any PSR-14 compatible event dispatcher implementation.
Tusk\Event\UploadComplete is fired when a file has been uploaded completely.
It has one method, fileId() which can be called to get the file's ID.
Tusk is compatible with tus 1.0.0 and the following extensions: