{"id":18458979,"url":"https://github.com/he426100/tus-php-hyperf","last_synced_at":"2026-02-23T03:22:07.525Z","repository":{"id":42053206,"uuid":"483079980","full_name":"he426100/tus-php-hyperf","owner":"he426100","description":"The Hyperf Tus-php package.","archived":false,"fork":false,"pushed_at":"2025-04-23T07:30:25.000Z","size":64,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-23T11:49:30.736Z","etag":null,"topics":["hyperf","resumable-upload","tus","tus-protocol"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/he426100.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-04-19T03:22:27.000Z","updated_at":"2025-04-23T07:30:28.000Z","dependencies_parsed_at":"2025-04-23T17:40:28.682Z","dependency_job_id":"5e36ab31-e1da-4a95-9a7b-7c6180d263cd","html_url":"https://github.com/he426100/tus-php-hyperf","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/he426100/tus-php-hyperf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he426100%2Ftus-php-hyperf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he426100%2Ftus-php-hyperf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he426100%2Ftus-php-hyperf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he426100%2Ftus-php-hyperf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/he426100","download_url":"https://codeload.github.com/he426100/tus-php-hyperf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he426100%2Ftus-php-hyperf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261978910,"owners_count":23239417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hyperf","resumable-upload","tus","tus-protocol"],"created_at":"2024-11-06T08:21:10.490Z","updated_at":"2026-02-23T03:22:02.495Z","avatar_url":"https://github.com/he426100.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hyperf 可恢复文件上传组件\n\n该组件移植了 Tus-php 组件（[Tus-php](https://github.com/ankitpokhrel/tus-php )）相对完整的功能特性。\n\n* Swoole无法获取 `php://input`，用 `Swoole\\Http\\Request-\u003egetContent()` 代替\n\n## 安装\n\n```shell script\ncomposer require he426100/tus-php-hyperf\n```\n\n## 发布配置\n\n```shell script\nphp bin/hyperf.php vendor:publish he426100/tus-php-hyperf\n```\n\n\u003e 文件位于 `config/autoload/tus.php`。\n\n## 使用示例\n\n* hyperf/app/Controller/TusController.php\n```\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Controller;\n\nuse Tus\\Tus\\Server;\n\nclass TusController extends AbstractController\n{\n    public function index()\n    {\n        $server = (new Server($this-\u003erequest, $this-\u003eresponse))-\u003esetUploadDir(\\dirname(__DIR__, 3) . '/public/' . 'uploads');\n        return $server-\u003eserve();\n    }\n}\n```\n\n* nano/index.php\n```\n\u003c?php\n\nuse Tus\\Tus\\Server;\nuse Hyperf\\Nano\\Factory\\AppFactory;\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$app = AppFactory::create();\n\n$app-\u003econfig([\n    'cache.default' =\u003e [\n        'driver' =\u003e \\Hyperf\\Cache\\Driver\\RedisDriver::class,\n        'packer' =\u003e \\Hyperf\\Utils\\Packer\\PhpSerializerPacker::class,\n        'prefix' =\u003e 'c:',\n    ],\n]);\n\n$app-\u003eaddRoute(['HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'], '/', function() {\n    $server = new Server($this-\u003erequest, $this-\u003eresponse);\n    return $server-\u003eserve();\n});\n\n$app-\u003erun();\n```\n\n* uppy.html\n```\n\u003c!doctype html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n    \u003cmeta charset=\"utf-8\"\u003e\n    \u003ctitle\u003eUppy\u003c/title\u003e\n    \u003clink href=\"https://releases.transloadit.com/uppy/v2.7.0/uppy.min.css\" rel=\"stylesheet\"\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n    \u003cdiv id=\"drag-drop-area\"\u003e\u003c/div\u003e\n\n    \u003cscript src=\"https://releases.transloadit.com/uppy/v2.7.0/uppy.min.js\"\u003e\u003c/script\u003e\n    \u003cscript\u003e\n        var uppy = new Uppy.Core()\n        .use(Uppy.Dashboard, {\n            inline: true,\n            target: '#drag-drop-area'\n        })\n        .use(Uppy.Tus, { \n            endpoint: 'http://localhost:9501',\n            chunkSize: 1 * 1024 * 1024\n        })\n\n        uppy.on('complete', (result) =\u003e {\n        console.log('Upload complete! We’ve uploaded these files:', result.successful)\n        })\n    \u003c/script\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhe426100%2Ftus-php-hyperf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhe426100%2Ftus-php-hyperf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhe426100%2Ftus-php-hyperf/lists"}