{"id":19210001,"url":"https://github.com/zencodex/flysystem-upyun","last_synced_at":"2025-06-23T05:06:15.439Z","repository":{"id":57089814,"uuid":"188073103","full_name":"zencodex/flysystem-upyun","owner":"zencodex","description":"Flysystem adapter for Upyun（又拍云的文件操作封装），同时支持 Laravel Storage","archived":false,"fork":false,"pushed_at":"2023-08-02T00:28:12.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-23T05:04:47.661Z","etag":null,"topics":["flysystem","flysystem-adapter","upyun"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zencodex.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-05-22T16:10:49.000Z","updated_at":"2024-02-07T06:05:26.000Z","dependencies_parsed_at":"2024-11-09T13:44:49.054Z","dependency_job_id":null,"html_url":"https://github.com/zencodex/flysystem-upyun","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.11111111111111116","last_synced_commit":"b445087725b8be45a79d08749127952903b8fc1b"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/zencodex/flysystem-upyun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fflysystem-upyun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fflysystem-upyun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fflysystem-upyun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fflysystem-upyun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zencodex","download_url":"https://codeload.github.com/zencodex/flysystem-upyun/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zencodex%2Fflysystem-upyun/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261417568,"owners_count":23155072,"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":["flysystem","flysystem-adapter","upyun"],"created_at":"2024-11-09T13:33:54.438Z","updated_at":"2025-06-23T05:06:10.423Z","avatar_url":"https://github.com/zencodex.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/zencodex/flysystem-upyun/v/stable)](https://packagist.org/packages/zencodex/flysystem-upyun)\n[![Total Downloads](https://poser.pugx.org/zencodex/flysystem-upyun/downloads)](https://packagist.org/packages/zencodex/flysystem-upyun)\n[![Latest Unstable Version](https://poser.pugx.org/zencodex/flysystem-upyun/v/unstable)](https://packagist.org/packages/zencodex/flysystem-upyun)\n[![composer.lock](https://poser.pugx.org/zencodex/flysystem-upyun/composerlock)](https://packagist.org/packages/zencodex/flysystem-upyun)\n[![License](https://poser.pugx.org/zencodex/flysystem-upyun/license)](https://packagist.org/packages/zencodex/flysystem-upyun)\n\n\u003e 已支持到 php \u003e= 8.2, laravel 10.x\n\n# Requirement\n\n- PHP \u003e= 5.5.9\n\n# 安装\n\n直接可以通过 composer 来安装:\n```sh\n$ composer require \"zencodex/flysystem-upyun\"\n```\n\n# 使用\n\n## 1. 直接使用\n\n```php\n\nuse League\\Flysystem\\Filesystem;\nuse ZenCodex\\Support\\Flysystem\\Adapter\\UpyunAdapter\n\n$config =\u003e [\n    'driver'        =\u003e 'upyun',\n    'bucket'        =\u003e '', // 服务名字\n    'operator'      =\u003e '', // 操作员的名字\n    'password'      =\u003e '', // 操作员的密码\n    'domain'        =\u003e '', // 服务分配的域名\n    'protocol'      =\u003e 'https', // 服务使用的协议，如需使用 http，在此配置 http\n];\n\n$adapter = new UpyunAdapter((object)$config);\n\n// 或在 Laravel 中获取 $adapter\n$adapter = Storage::disk('upyun')-\u003egetAdapter();\n\n$adapter-\u003ewrite('file.md', 'contents');\n$adapter-\u003ewriteStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));\n\n$adapter-\u003erename('foo.md', 'bar.md');\n$adapter-\u003ecopy('foo.md', 'foo2.md');\n$adapter-\u003edelete('file.md');\n$adapter-\u003egetUrl('/path/foo/bar/file.md');\n\n$adapter-\u003efileExists('file.md');\n$adapter-\u003edirectoryExists('path/to/dir');\n$adapter-\u003eread('file.md');\n\n// ...\n// $adapter 详细调用方法可参考: src/Adapter/UpyunAdapter.php\n\n// $clientHandler 为 Upyun::class, 直接调用 Upyun 内的方法\n$clientHandler = $adapter-\u003egetClientHandler();\n$clientHandler-\u003epurge($remoteUrl);\n$clientHandler-\u003eusage();\n```\n\n\u003e \n\n## 2. 在 Laravel 中使用\n\n1)、`config/app.php` 中添加 `UpyunServiceProvider`:\n\n```php\n\n'providers' =\u003e [\n    // ...\n    ZenCodex\\Support\\Flysystem\\UpyunServiceProvider::class,\n],\n```\n\n2)、`config/filesystems.php` 的 `disks` 中添加下面的配置：\n\n```php\n'disks' =\u003e [\n    // ...\n\n    'upyun' =\u003e [\n        'driver'        =\u003e 'upyun',\n        'bucket'        =\u003e env('UPYUN_BUCKET', ''),// 服务名字\n        'operator'      =\u003e env('UPYUN_OPERATOR_NAME', ''), // 操作员的名字\n        'password'      =\u003e env('UPYUN_OPERATOR_PASSWORD', ''), // 操作员的密码\n        'domain'        =\u003e env('UPYUN_DOMAIN', ''), // 服务分配的域名\n        'protocol'     =\u003e 'https', // 服务使用的协议，如需使用 http，在此配置 http\n    ]\n]\n```\n\n3)、Laravel Storage 标准 API 调用\n\n```php\n$disk = Storage::disk('upyun');\n\n$disk-\u003ewrite('file.md', 'contents');\n$disk-\u003ewriteStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));\n\n$disk-\u003erename('foo.md', 'bar.md');\n$disk-\u003ecopy('foo.md', 'foo2.md');\n$disk-\u003edelete('file.md');\n\n$disk-\u003efileExists('file.md');\n$disk-\u003edirectoryExists('path/to/dir');\n$disk-\u003eread('file.md');\n\n$disk-\u003elistContents();\n$disk-\u003efileSize('file.md');\n$disk-\u003emimeType('file.md');\n$disk-\u003eurl('/path/foo/bar/file.md');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzencodex%2Fflysystem-upyun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzencodex%2Fflysystem-upyun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzencodex%2Fflysystem-upyun/lists"}