{"id":17355053,"url":"https://github.com/hezhizheng/repo-storage","last_synced_at":"2025-06-16T06:05:32.744Z","repository":{"id":56987850,"uuid":"348651503","full_name":"hezhizheng/repo-storage","owner":"hezhizheng","description":"使用代码托管平台( github | coding | gitee )做自己 '私有' 的 '对象存储'","archived":false,"fork":false,"pushed_at":"2022-03-28T07:56:18.000Z","size":54,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-14T19:14:10.788Z","etag":null,"topics":["file-storage","github-api","object-storage","php"],"latest_commit_sha":null,"homepage":"https://hzz.cool","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/hezhizheng.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-17T09:31:47.000Z","updated_at":"2023-12-05T15:23:45.000Z","dependencies_parsed_at":"2022-08-21T12:50:24.998Z","dependency_job_id":null,"html_url":"https://github.com/hezhizheng/repo-storage","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hezhizheng/repo-storage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hezhizheng%2Frepo-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hezhizheng%2Frepo-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hezhizheng%2Frepo-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hezhizheng%2Frepo-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hezhizheng","download_url":"https://codeload.github.com/hezhizheng/repo-storage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hezhizheng%2Frepo-storage/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259924392,"owners_count":22932753,"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":["file-storage","github-api","object-storage","php"],"created_at":"2024-10-15T17:42:07.181Z","updated_at":"2025-06-16T06:05:32.711Z","avatar_url":"https://github.com/hezhizheng.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## repo-storage 使用代码托管平台(github|coding|gitee)做自己 '私有' 的 '对象存储'\n\n\u003e [github 地址](https://github.com/hezhizheng/repo-storage)\n\n## 功能\n- 支持github(jsdelivr加速)/coding/gitee\n- 已实现 上传 、删除、文件获取 接口\n\n## 使用\n- 安装 `composer require \"hzz/repo-storage @dev-master\"`\n- github token 获取 -\u003e https://github.com/settings/tokens/new\n- gitee token 获取 -\u003e https://gitee.com/profile/personal_access_tokens/new\n- Coding 开放平台 -\u003e https://help.coding.net/openapi\n```php\n\n// 使用简单工厂模式调用\n// gitee\n// $entity = \\Hzz\\StorageEntity::create('gitee',\"对应gitee平台的token\");\n$entity = \\Hzz\\StorageEntity::create('github',\"对应github平台的token\");\n\n// 请求参数说明\n$_data = [\n    'owner' =\u003e \"\", // 用户名\n    'repo' =\u003e \"\", // 仓库名称\n    'path' =\u003e \"\", // 文件存储的路径\n    'file' =\u003e \"\", // 上传时使用文件绝对路径或者base64，删除时使用仓库中对应的文件名\n    'sha' =\u003e \"\",  // 删除文件的 sha 标识\n];\n\n// 上传\n$data[\"owner\"] = \"hezhizheng\";\n$data[\"repo\"] = \"static-image-hosting\";\n$data[\"path\"] = \"files\";\n$data[\"file\"] = \"/xxxpath/1.png\";\n$res = $entity-\u003eput($data); // 文件访问地址 github为 $res['content']['cdn_url']  gitee 为 $res['content']['download_url']\n\n// 删除\n$data[\"owner\"] = \"hezhizheng\";\n$data[\"repo\"] = \"static-image-hosting\";\n$data[\"path\"] = \"files\";\n$data[\"file\"] = \"20210317170512_6051c64896104.png\";\n$data[\"sha\"] = \"213231fd035a1ea05e5ccaba94cfa4d1acd6e81d\";\n$entity-\u003edelete($data);\n\n// 获取文件\n$data[\"owner\"] = \"hezhizheng\";\n$data[\"repo\"] = \"static-image-hosting\";\n$data[\"path\"] = \"files\";\n$entity-\u003eget($data);\n\n// 使用策略模式调用\n$server = new \\Hzz\\StoreStrategy(new \\Hzz\\Github(\"对应github平台的token\"));\n$server-\u003eserve-\u003eget($data); $server-\u003eserve-\u003eput($data); $server-\u003eserve-\u003edelete($data);\n```\n详细用法可参考 [tests](./tests) 用例\n\n## License\n[MIT](./LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhezhizheng%2Frepo-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhezhizheng%2Frepo-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhezhizheng%2Frepo-storage/lists"}