{"id":13704697,"url":"https://github.com/jacobcyl/Aliyun-oss-storage","last_synced_at":"2025-05-05T10:30:49.121Z","repository":{"id":8687678,"uuid":"59362067","full_name":"jacobcyl/Aliyun-oss-storage","owner":"jacobcyl","description":"阿里云OSS laravel storage Filesystem adapter, 打造Laravel最好的OSS Storage扩展.","archived":false,"fork":false,"pushed_at":"2021-08-17T02:21:49.000Z","size":61,"stargazers_count":521,"open_issues_count":58,"forks_count":160,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-23T23:39:15.477Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://jacobcyl.github.io/Aliyun-oss-storage/","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/jacobcyl.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}},"created_at":"2016-05-21T13:45:31.000Z","updated_at":"2024-11-22T05:30:45.000Z","dependencies_parsed_at":"2022-08-07T04:16:42.666Z","dependency_job_id":null,"html_url":"https://github.com/jacobcyl/Aliyun-oss-storage","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobcyl%2FAliyun-oss-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobcyl%2FAliyun-oss-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobcyl%2FAliyun-oss-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobcyl%2FAliyun-oss-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacobcyl","download_url":"https://codeload.github.com/jacobcyl/Aliyun-oss-storage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251582931,"owners_count":21612743,"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":[],"created_at":"2024-08-02T21:01:18.323Z","updated_at":"2025-05-05T10:30:48.813Z","avatar_url":"https://github.com/jacobcyl.png","language":"PHP","funding_links":[],"categories":["配置 Configuration","第三方API( Third Party APIs )"],"sub_categories":["第三方api Third Party APIs"],"readme":"# Aliyun-oss-storage for Laravel 5+\nAliyun oss filesystem storage adapter for laravel 5. You can use Aliyun OSS just like laravel Storage as usual.    \n借鉴了一些优秀的代码，综合各方，同时做了更多优化，将会添加更多完善的接口和插件，打造Laravel最好的OSS Storage扩展\n## Inspired By\n- [thephpleague/flysystem-aws-s3-v2](https://github.com/thephpleague/flysystem-aws-s3-v2)\n- [apollopy/flysystem-aliyun-oss](https://github.com/apollopy/flysystem-aliyun-oss) \n\n## Require\n- Laravel 5+\n- cURL extension\n\n##Installation\nIn order to install AliOSS-storage, just add\n\n    \"jacobcyl/ali-oss-storage\": \"^2.1\"\n\nto your composer.json. Then run `composer install` or `composer update`.  \nOr you can simply run below command to install:\n\n    \"composer require jacobcyl/ali-oss-storage:^2.1\"\n    \nThen in your `config/app.php` add this line to providers array:\n```php\nJacobcyl\\AliOSS\\AliOssServiceProvider::class,\n```\n## Configuration\nAdd the following in app/filesystems.php:\n```php\n'disks'=\u003e[\n    ...\n    'oss' =\u003e [\n            'driver'        =\u003e 'oss',\n            'access_id'     =\u003e '\u003cYour Aliyun OSS AccessKeyId\u003e',\n            'access_key'    =\u003e '\u003cYour Aliyun OSS AccessKeySecret\u003e',\n            'bucket'        =\u003e '\u003cOSS bucket name\u003e',\n            'endpoint'      =\u003e '\u003cthe endpoint of OSS, E.g: oss-cn-hangzhou.aliyuncs.com | custom domain, E.g:img.abc.com\u003e', // OSS 外网节点或自定义外部域名\n            //'endpoint_internal' =\u003e '\u003cinternal endpoint [OSS内网节点] 如：oss-cn-shenzhen-internal.aliyuncs.com\u003e', // v2.0.4 新增配置属性，如果为空，则默认使用 endpoint 配置(由于内网上传有点小问题未解决，请大家暂时不要使用内网节点上传，正在与阿里技术沟通中)\n            'cdnDomain'     =\u003e '\u003cCDN domain, cdn域名\u003e', // 如果isCName为true, getUrl会判断cdnDomain是否设定来决定返回的url，如果cdnDomain未设置，则使用endpoint来生成url，否则使用cdn\n            'ssl'           =\u003e \u003ctrue|false\u003e // true to use 'https://' and false to use 'http://'. default is false,\n            'isCName'       =\u003e \u003ctrue|false\u003e // 是否使用自定义域名,true: 则Storage.url()会使用自定义的cdn或域名生成文件url， false: 则使用外部节点生成url\n            'debug'         =\u003e \u003ctrue|false\u003e\n    ],\n    ...\n]\n```\nThen set the default driver in app/filesystems.php:\n```php\n'default' =\u003e 'oss',\n```\nOk, well! You are finish to configure. Just feel free to use Aliyun OSS like Storage!\n\n## Usage\nSee [Larave doc for Storage](https://laravel.com/docs/5.2/filesystem#custom-filesystems)\nOr you can learn here:\n\n\u003e First you must use Storage facade\n\n```php\nuse Illuminate\\Support\\Facades\\Storage;\n```    \n\u003e Then You can use all APIs of laravel Storage\n\n```php\nStorage::disk('oss'); // if default filesystems driver is oss, you can skip this step\n\n//fetch all files of specified bucket(see upond configuration)\nStorage::files($directory);\nStorage::allFiles($directory);\n\nStorage::put('path/to/file/file.jpg', $contents); //first parameter is the target file path, second paramter is file content\nStorage::putFile('path/to/file/file.jpg', 'local/path/to/local_file.jpg'); // upload file from local path\n\nStorage::get('path/to/file/file.jpg'); // get the file object by path\nStorage::exists('path/to/file/file.jpg'); // determine if a given file exists on the storage(OSS)\nStorage::size('path/to/file/file.jpg'); // get the file size (Byte)\nStorage::lastModified('path/to/file/file.jpg'); // get date of last modification\n\nStorage::directories($directory); // Get all of the directories within a given directory\nStorage::allDirectories($directory); // Get all (recursive) of the directories within a given directory\n\nStorage::copy('old/file1.jpg', 'new/file1.jpg');\nStorage::move('old/file1.jpg', 'new/file1.jpg');\nStorage::rename('path/to/file1.jpg', 'path/to/file2.jpg');\n\nStorage::prepend('file.log', 'Prepended Text'); // Prepend to a file.\nStorage::append('file.log', 'Appended Text'); // Append to a file.\n\nStorage::delete('file.jpg');\nStorage::delete(['file1.jpg', 'file2.jpg']);\n\nStorage::makeDirectory($directory); // Create a directory.\nStorage::deleteDirectory($directory); // Recursively delete a directory.It will delete all files within a given directory, SO Use with caution please.\n\n// upgrade logs\n// new plugin for v2.0 version\nStorage::putRemoteFile('target/path/to/file/jacob.jpg', 'http://example.com/jacob.jpg'); //upload remote file to storage by remote url\n// new function for v2.0.1 version\nStorage::url('path/to/img.jpg') // get the file url\n```\n\n## Documentation\nMore development detail see [Aliyun OSS DOC](https://help.aliyun.com/document_detail/32099.html?spm=5176.doc31981.6.335.eqQ9dM)\n## License\nSource code is release under MIT license. Read LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobcyl%2FAliyun-oss-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobcyl%2FAliyun-oss-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobcyl%2FAliyun-oss-storage/lists"}