Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/he426100/tus-php-hyperf
The Hyperf Tus-php package.
https://github.com/he426100/tus-php-hyperf
hyperf resumable-upload tus tus-protocol
Last synced: about 4 hours ago
JSON representation
The Hyperf Tus-php package.
- Host: GitHub
- URL: https://github.com/he426100/tus-php-hyperf
- Owner: he426100
- License: mit
- Created: 2022-04-19T03:22:27.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-08-19T10:14:18.000Z (about 2 years ago)
- Last Synced: 2024-05-12T19:02:56.657Z (6 months ago)
- Topics: hyperf, resumable-upload, tus, tus-protocol
- Language: PHP
- Homepage:
- Size: 50.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hyperf 可恢复文件上传组件
该组件移植了 Tus-php 组件([Tus-php](https://github.com/ankitpokhrel/tus-php ))相对完整的功能特性。
* Swoole无法获取 `php://input`,用 `Swoole\Http\Request->getContent()` 代替
## 安装
```shell script
composer require he426100/tus-php-hyperf
```## 发布配置
```shell script
php bin/hyperf.php vendor:publish he426100/tus-php-hyperf
```> 文件位于 `config/autoload/tus.php`。
## 使用示例
* hyperf/app/Controller/TusController.php
```
request, $this->response))->setUploadDir(\dirname(__DIR__, 3) . '/public/' . 'uploads');
return $server->serve();
}
}
```* nano/index.php
```
config([
'cache.default' => [
'driver' => \Hyperf\Cache\Driver\RedisDriver::class,
'packer' => \Hyperf\Utils\Packer\PhpSerializerPacker::class,
'prefix' => 'c:',
],
]);$app->addRoute(['HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'], '/', function() {
$server = new Server($this->request, $this->response);
return $server->serve();
});$app->run();
```* uppy.html
```
Uppy
var uppy = new Uppy.Core()
.use(Uppy.Dashboard, {
inline: true,
target: '#drag-drop-area'
})
.use(Uppy.Tus, {
endpoint: 'http://localhost:9501',
chunkSize: 1 * 1024 * 1024
})uppy.on('complete', (result) => {
console.log('Upload complete! We’ve uploaded these files:', result.successful)
})
```