{"id":13462586,"url":"https://github.com/freyo/flysystem-qcloud-cos-v5","last_synced_at":"2025-04-05T04:13:44.843Z","repository":{"id":27393967,"uuid":"103510636","full_name":"freyo/flysystem-qcloud-cos-v5","owner":"freyo","description":"💾 Flysystem Adapter for Tencent Cloud COS V5","archived":false,"fork":false,"pushed_at":"2022-03-27T14:21:24.000Z","size":168,"stargazers_count":155,"open_issues_count":5,"forks_count":24,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T03:08:18.532Z","etag":null,"topics":["cos","flysystem-adapter","flysystem-qcloud-cos","laravel","php"],"latest_commit_sha":null,"homepage":"https://intl.cloud.tencent.com/product/cos?lang=en","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/freyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"open_collective":"flysystem-qcloud-cos-v5"}},"created_at":"2017-09-14T09:01:26.000Z","updated_at":"2025-03-14T08:48:31.000Z","dependencies_parsed_at":"2022-08-07T12:16:31.664Z","dependency_job_id":null,"html_url":"https://github.com/freyo/flysystem-qcloud-cos-v5","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freyo%2Fflysystem-qcloud-cos-v5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freyo%2Fflysystem-qcloud-cos-v5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freyo%2Fflysystem-qcloud-cos-v5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freyo%2Fflysystem-qcloud-cos-v5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freyo","download_url":"https://codeload.github.com/freyo/flysystem-qcloud-cos-v5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284951,"owners_count":20913704,"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":["cos","flysystem-adapter","flysystem-qcloud-cos","laravel","php"],"created_at":"2024-07-31T12:00:52.888Z","updated_at":"2025-04-05T04:13:44.820Z","avatar_url":"https://github.com/freyo.png","language":"PHP","funding_links":["https://opencollective.com/flysystem-qcloud-cos-v5"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"\u003cdiv\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cimage src=\"https://imgcache.qq.com/open_proj/proj_qcloud_v2/international/doc/css/img/icon/icon-storage.svg\" width=\"150\" height=\"150\"\u003e\n  \u003c/p\u003e\n  \u003cp align=\"center\"\u003eFlysystem Adapter for \u003ca href=\"https://github.com/tencentyun/cos-php-sdk-v5\"\u003eTencent Cloud Object Storage\u003c/a\u003e\u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"LICENSE\"\u003e\n      \u003cimage src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\" alt=\"Software License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://travis-ci.org/freyo/flysystem-qcloud-cos-v5\"\u003e\n      \u003cimage src=\"https://img.shields.io/travis/freyo/flysystem-qcloud-cos-v5/master.svg?style=flat-square\" alt=\"Build Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://scrutinizer-ci.com/g/freyo/flysystem-qcloud-cos-v5\"\u003e\n      \u003cimage src=\"https://img.shields.io/scrutinizer/coverage/g/freyo/flysystem-qcloud-cos-v5.svg?style=flat-square\" alt=\"Coverage Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://scrutinizer-ci.com/g/freyo/flysystem-qcloud-cos-v5\"\u003e\n      \u003cimage src=\"https://img.shields.io/scrutinizer/g/freyo/flysystem-qcloud-cos-v5.svg?style=flat-square\" alt=\"Quality Score\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/freyo/flysystem-qcloud-cos-v5\"\u003e\n      \u003cimage src=\"https://img.shields.io/packagist/v/freyo/flysystem-qcloud-cos-v5.svg?style=flat-square\" alt=\"Packagist Version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/freyo/flysystem-qcloud-cos-v5\"\u003e\n      \u003cimage src=\"https://img.shields.io/packagist/dt/freyo/flysystem-qcloud-cos-v5.svg?style=flat-square\" alt=\"Total Downloads\"\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://app.fossa.io/projects/git%2Bgithub.com%2Ffreyo%2Fflysystem-qcloud-cos-v5?ref=badge_small\"\u003e\n      \u003cimg src=\"https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffreyo%2Fflysystem-qcloud-cos-v5.svg?type=small\"  alt=\"FOSSA Status\"\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n## Installation\n\n  \u003e Support Laravel/Lumen 5.x/6.x/7.x/8.x\n\n  ```shell\n  composer require \"freyo/flysystem-qcloud-cos-v5:^2.0\" -vvv\n  ```\n\n## Bootstrap\n\n  ```php\n  \u003c?php\n  use Freyo\\Flysystem\\QcloudCOSv5\\Adapter;\n  use League\\Flysystem\\Filesystem;\n  use Qcloud\\Cos\\Client;\n\n  include __DIR__ . '/vendor/autoload.php';\n\n  $config = [\n      'region'          =\u003e 'ap-guangzhou',\n      'credentials'     =\u003e [\n          'appId'     =\u003e 'your-app-id',\n          'secretId'  =\u003e 'your-secret-id',\n          'secretKey' =\u003e 'your-secret-key',\n          'token'     =\u003e null,\n      ],\n      'timeout'         =\u003e 60,\n      'connect_timeout' =\u003e 60,\n      'bucket'          =\u003e 'your-bucket-name',\n      'cdn'             =\u003e '',\n      'scheme'          =\u003e 'https',\n      'read_from_cdn'   =\u003e false,\n      'cdn_key'         =\u003e '',\n      'encrypt'         =\u003e false,\n  ];\n  \n  $client     = new Client($config);\n  $adapter    = new Adapter($client, $config);\n  $filesystem = new Filesystem($adapter);\n  ```\n\n### API\n\n```php\nbool $flysystem-\u003ewrite('file.md', 'contents');\n\nbool $flysystem-\u003ewriteStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));\n\nbool $flysystem-\u003eupdate('file.md', 'new contents');\n\nbool $flysystem-\u003eupdateStram('file.md', fopen('path/to/your/local/file.jpg', 'r'));\n\nbool $flysystem-\u003erename('foo.md', 'bar.md');\n\nbool $flysystem-\u003ecopy('foo.md', 'foo2.md');\n\nbool $flysystem-\u003edelete('file.md');\n\nbool $flysystem-\u003ehas('file.md');\n\nstring|false $flysystem-\u003eread('file.md');\n\narray $flysystem-\u003elistContents();\n\narray $flysystem-\u003egetMetadata('file.md');\n\nint $flysystem-\u003egetSize('file.md');\n\nstring $flysystem-\u003egetUrl('file.md'); \n\nstring $flysystem-\u003egetTemporaryUrl('file.md', date_create('2018-12-31 18:12:31')); \n\nstring $flysystem-\u003egetMimetype('file.md');\n\nint $flysystem-\u003egetTimestamp('file.md');\n\nstring $flysystem-\u003egetVisibility('file.md');\n\nbool $flysystem-\u003esetVisibility('file.md', 'public'); //or 'private', 'default'\n```\n\n[Full API documentation.](http://flysystem.thephpleague.com/api/)\n\n## Use in Laravel\n  \n**Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.**\n\n1. Register the service provider in `config/app.php`:\n\n  ```php\n  'providers' =\u003e [\n    // ...\n    Freyo\\Flysystem\\QcloudCOSv5\\ServiceProvider::class,\n  ]\n  ```\n\n2. Configure `config/filesystems.php`:\n\n  ```php\n  'disks'=\u003e[\n      // ...\n      'cosv5' =\u003e [\n            'driver' =\u003e 'cosv5',\n            'region'          =\u003e env('COSV5_REGION', 'ap-guangzhou'),\n            'credentials'     =\u003e [\n                'appId'     =\u003e env('COSV5_APP_ID'),\n                'secretId'  =\u003e env('COSV5_SECRET_ID'),\n                'secretKey' =\u003e env('COSV5_SECRET_KEY'),\n                'token'     =\u003e env('COSV5_TOKEN'),\n            ],\n            'timeout'         =\u003e env('COSV5_TIMEOUT', 60),\n            'connect_timeout' =\u003e env('COSV5_CONNECT_TIMEOUT', 60),\n            'bucket'          =\u003e env('COSV5_BUCKET'),\n            'cdn'             =\u003e env('COSV5_CDN'),\n            'scheme'          =\u003e env('COSV5_SCHEME', 'https'),\n            'read_from_cdn'   =\u003e env('COSV5_READ_FROM_CDN', false),\n            'cdn_key'         =\u003e env('COSV5_CDN_KEY'),\n            'encrypt'         =\u003e env('COSV5_ENCRYPT', false),\n      ],\n  ],\n  ```\n\n3. Configure `.env`:\n  \n  ```php\n  COSV5_APP_ID=\n  COSV5_SECRET_ID=\n  COSV5_SECRET_KEY=\n  COSV5_TOKEN=null\n  COSV5_TIMEOUT=60\n  COSV5_CONNECT_TIMEOUT=60\n  COSV5_BUCKET=\n  COSV5_REGION=ap-guangzhou\n  COSV5_CDN=\n  COSV5_SCHEME=https\n  COSV5_READ_FROM_CDN=false\n  COSV5_CDN_KEY=\n  COSV5_ENCRYPT=false\n  ```\n\n## Use in Lumen\n\n1. Add the following code to your `bootstrap/app.php`:\n\n  ```php\n  $app-\u003esingleton('filesystem', function ($app) {\n      $app-\u003ealias('filesystem', Illuminate\\Contracts\\Filesystem\\Factory::class);\n      return $app-\u003eloadComponent(\n          'filesystems',\n          Illuminate\\Filesystem\\FilesystemServiceProvider::class,\n          'filesystem'\n      );\n  });\n  ```\n\n2. And this:\n  \n  ```php\n  $app-\u003eregister(Freyo\\Flysystem\\QcloudCOSv5\\ServiceProvider::class);\n  ```\n\n3. Configure `.env`:\n  \n  ```php\n  COSV5_APP_ID=\n  COSV5_SECRET_ID=\n  COSV5_SECRET_KEY=\n  COSV5_TOKEN=null\n  COSV5_TIMEOUT=60\n  COSV5_CONNECT_TIMEOUT=60\n  COSV5_BUCKET=\n  COSV5_REGION=ap-guangzhou\n  COSV5_CDN=\n  COSV5_SCHEME=https\n  COSV5_READ_FROM_CDN=false\n  COSV5_CDN_KEY=\n  COSV5_ENCRYPT=false\n  ```\n\n### Usage\n\n```php\n$disk = Storage::disk('cosv5');\n\n// create a file\n$disk-\u003eput('avatars/1', $fileContents);\n\n// check if a file exists\n$exists = $disk-\u003ehas('file.jpg');\n\n// get timestamp\n$time = $disk-\u003elastModified('file1.jpg');\n\n// copy a file\n$disk-\u003ecopy('old/file1.jpg', 'new/file1.jpg');\n\n// move a file\n$disk-\u003emove('old/file1.jpg', 'new/file1.jpg');\n\n// get file contents\n$contents = $disk-\u003eread('folder/my_file.txt');\n\n// get url\n$url = $disk-\u003eurl('new/file1.jpg');\n$temporaryUrl = $disk-\u003etemporaryUrl('new/file1.jpg', Carbon::now()-\u003eaddMinutes(5));\n\n// create a file from remote(plugin)\n$disk-\u003eputRemoteFile('avatars/1', 'http://example.org/avatar.jpg');\n$disk-\u003eputRemoteFileAs('avatars/1', 'http://example.org/avatar.jpg', 'file1.jpg');\n\n// refresh cdn cache(plugin)\n$disk-\u003ecdn()-\u003erefreshUrl(['http://your-cdn-host/path/to/avatar.jpg']);\n$disk-\u003ecdn()-\u003erefreshDir(['http://your-cdn-host/path/to/']);\n$disk-\u003ecdn()-\u003epushUrl(['http://your-cdn-host/path/to/avatar.jpg']);\n$disk-\u003ecdn()-\u003erefreshOverseaUrl(['http://your-cdn-host/path/to/avatar.jpg']);\n$disk-\u003ecdn()-\u003erefreshOverseaDir(['http://your-cdn-host/path/to/']);\n$disk-\u003ecdn()-\u003epushOverseaUrl(['http://your-cdn-host/path/to/avatar.jpg']);\n\n// cdn url signature(plugin)\n$url = 'http://www.test.com/1.mp4';\n$disk-\u003ecdn()-\u003esignatureA($url, $key = null, $timestamp = null, $random = null, $signName = 'sign');\n$disk-\u003ecdn()-\u003esignatureB($url, $key = null, $timestamp = null);\n$disk-\u003ecdn()-\u003esignatureC($url, $key = null, $timestamp = null);\n$disk-\u003ecdn()-\u003esignatureD($url, $key = null, $timestamp = null, $signName = 'sign', $timeName = 't');\n\n// tencent captcha(plugin)\n$disk-\u003etcaptcha($aid, $appSecretKey)-\u003everify($ticket, $randStr, $userIP);\n\n// get federation token(plugin)\n$disk-\u003egetFederationToken($path = '*', $seconds = 7200, Closure $customPolicy = null, $name = 'cos')\n$disk-\u003egetFederationTokenV3($path = '*', $seconds = 7200, Closure $customPolicy = null, $name = 'cos')\n\n// tencent image process(plugin)\n$disk-\u003ecloudInfinite()-\u003eimageProcess($objectKey, array $picOperations);\n$disk-\u003ecloudInfinite()-\u003econtentRecognition($objectKey, array $contentRecognition);\n```\n\n[Full API documentation.](https://laravel.com/api/8.x/Illuminate/Contracts/Filesystem/Cloud.html)\n\n## Regions \u0026 Endpoints\n\n[Official Documentation](https://intl.cloud.tencent.com/document/product/436/6224?lang=en)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffreyo%2Fflysystem-qcloud-cos-v5.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffreyo%2Fflysystem-qcloud-cos-v5?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreyo%2Fflysystem-qcloud-cos-v5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreyo%2Fflysystem-qcloud-cos-v5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreyo%2Fflysystem-qcloud-cos-v5/lists"}