All Projects → alphasnow → aliyun-oss-laravel

alphasnow / aliyun-oss-laravel

Licence: MIT license
Laravel 的 Aliyun OSS 扩展, 支持 Laravel 9. Alibaba Cloud Object Storage Service For Laravel.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to aliyun-oss-laravel

tiny-oss
A tiny aliyun oss sdk for browser which focus on uploading.
Stars: ✭ 25 (-72.53%)
Mutual labels:  oss, aliyun
Aliyun Sdk Js
阿里云 SDK for Javascript,支持在浏览器和 Nodejs 环境使用,支持大部分阿里云服务。
Stars: ✭ 727 (+698.9%)
Mutual labels:  oss, aliyun
xayah
WEB文件管理器
Stars: ✭ 19 (-79.12%)
Mutual labels:  oss, aliyun
vue-oss
基于vue2+plupload的阿里云OSS上传组件(支持断点续传,可上传size>100M的文件)
Stars: ✭ 33 (-63.74%)
Mutual labels:  oss, aliyun
Xdupdate
Android 自动更新 / 阿里云 OSS 一键上传更新 (Android auto update / upload update by aliyun OSS)
Stars: ✭ 92 (+1.1%)
Mutual labels:  oss, aliyun
ali-img
阿里云图像处理工具包
Stars: ✭ 16 (-82.42%)
Mutual labels:  oss, aliyun
Aliyunoss
阿里云 OSS 官方 SDK 的 Composer 封装,支持任何 PHP 项目,包括 Laravel、Symfony、TinyLara 等等。
Stars: ✭ 481 (+428.57%)
Mutual labels:  oss, aliyun
aliyun-oss-deploy
🙈 一个 nodejs 命令行工具,用于部署静态资源到 aliyun oss,支持代码方式和 CLI 方式!
Stars: ✭ 31 (-65.93%)
Mutual labels:  oss, aliyun
Waliyun
阿里云Node.js Open API SDK(完整版)
Stars: ✭ 40 (-56.04%)
Mutual labels:  oss, aliyun
Aliyun Oss
Aliyun oss for Laravel5, also support flysystem adapter
Stars: ✭ 31 (-65.93%)
Mutual labels:  oss, aliyun
Laravel Filesystem Qiniu
A Qiniu Storage filesystem for Laravel
Stars: ✭ 437 (+380.22%)
Mutual labels:  filesystem, laravel-package
Go Fastdfs
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic r…
Stars: ✭ 2,923 (+3112.09%)
Mutual labels:  oss, filesystem
laravel-filesystem-cos
Tencent Cloud COS storage for Laravel based on overtrue/flysystem-cos.
Stars: ✭ 56 (-38.46%)
Mutual labels:  flysystem-adapter, laravel-filesystem
aliyun-oss-wordpress
使用阿里云对象存储 OSS 作为附件存储空间的WordPress插件。QQ交流群:887595381
Stars: ✭ 56 (-38.46%)
Mutual labels:  oss, aliyun
Aliyungo
Go SDK for Aliyun (Alibaba Cloud) - Golang API for ECS, OSS, DNS, SLB, RDS, RAM, MNS, STS, SLS, MQ, Push, OpenSearch, DM, Container Service etc.
Stars: ✭ 756 (+730.77%)
Mutual labels:  oss, aliyun
Ali Oss
Aliyun OSS(open storage service) JavaScript SDK for the browser and Node.js
Stars: ✭ 1,579 (+1635.16%)
Mutual labels:  oss, aliyun
laravel-admin
LaravelAdmin是基于PHP开发的基础管理后台系统,做到开箱即用,为新项目开发省去了基础功能开发的步骤;此系统采用前后端分离模式,后端使用Laravel,前端使用vue;主要包含:登录、注销、可视化数据大屏、管理员、角色管理、菜单管理、权限管理、错误日志、登录日志、访问日志、获取服务器CPU使用率、内存使用率等功能。后端主要使用Artisan命令行、Jobs消息队列、 Rules验证规则、Restful API、Composer扩展包、Redis秒杀、Extend自定义扩展类:微信授权、钉钉告警推送、MongoDB、阿里云OSS、七牛云存储、七牛云直播、php-jwt TOKEN、Phpoffice、MySql数据库字典、Elasticsearch等技术。
Stars: ✭ 45 (-50.55%)
Mutual labels:  oss, aliyun
laravel-secureheaders
🔒 SecureHeaders wrapper for Laravel.
Stars: ✭ 52 (-42.86%)
Mutual labels:  laravel-package
terraform-provider-graylog
Terraform Provider for Graylog
Stars: ✭ 21 (-76.92%)
Mutual labels:  oss
laravel-spotify
Laravel-Spotify is a simple wrapper around the Spotify Web API that makes working with its endpoints a breeze!
Stars: ✭ 141 (+54.95%)
Mutual labels:  laravel-package

English | 简体中文

Aliyun Oss Storage for Laravel

Alibaba Cloud Object Storage Service For Laravel

Latest Stable Version Total Downloads Test License Coverage Status

This package is a wrapper bridging aliyun-oss-flysystem into Laravel as an available storage disk.
If client direct transmission is required, Use web server signature direct transmission OSS extension package aliyun-oss-appserver.

Compatibility

laravel aliyun-oss-laravel driver readme
>=5.5,<9.0 ^3.0 aliyun readme
>=9.0 ^4.0 oss readme

Installation

  1. If you use the composer to manage project dependencies, run the following command in your project"s root directory:

    composer require alphasnow/aliyun-oss-laravel

    Then run composer install to install the dependency.

  2. Modify the environment file .env

    OSS_ACCESS_KEY_ID=<Your aliyun accessKeyId, Required>
    OSS_ACCESS_KEY_SECRET=<Your aliyun accessKeySecret, Required>
    OSS_BUCKET=<Your oss bucket name, Required>
    OSS_ENDPOINT=<Your oss endpoint domain, Required>
  3. (Optional) Modify the configuration file config/filesystems.php

    "default" => env("FILESYSTEM_DRIVER", "oss"),
    // ...
    "disks"=>[
        // ...
        "oss" => [
            "driver"            => "oss",
            "access_key_id"     => env("OSS_ACCESS_KEY_ID"),           // Required, YourAccessKeyId
            "access_key_secret" => env("OSS_ACCESS_KEY_SECRET"),       // Required, YourAccessKeySecret
            "bucket"            => env("OSS_BUCKET"),                  // Required, For example: my-bucket
            "endpoint"          => env("OSS_ENDPOINT"),                // Required, For example: oss-cn-shanghai.aliyuncs.com
            "internal"          => env("OSS_INTERNAL", null),          // Optional, For example: oss-cn-shanghai-internal.aliyuncs.com
            "domain"            => env("OSS_DOMAIN", null),            // Optional, For example: oss.my-domain.com
            "prefix"            => env("OSS_PREFIX", ""),              // Optional, The prefix of the store path
            "use_ssl"           => env("OSS_SSL", false),              // Optional, Whether to use HTTPS
            "reverse_proxy"     => env("OSS_REVERSE_PROXY", false),    // Optional, Whether to use the Reverse proxy, such as nginx
            "options"           => [],                                 // Optional, Add global configuration parameters, For example: [\OSS\OssClient::OSS_CHECK_MD5 => false]
            "macros"            => []                                  // Optional, Add custom Macro, For example: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class]
        ],
        // ...
    ]

Usage

use Illuminate\Support\Facades\Storage;
$storage = Storage::disk("oss");

Write

Storage::disk("oss")->putFile("dir/path", "/local/path/file.txt");
Storage::disk("oss")->putFileAs("dir/path", "/local/path/file.txt", "file.txt");

Storage::disk("oss")->put("dir/path/file.txt", file_get_contents("/local/path/file.txt"));
$fp = fopen("/local/path/file.txt","r");
Storage::disk("oss")->put("dir/path/file.txt", $fp);
fclose($fp);

Storage::disk("oss")->prepend("dir/path/file.txt", "Prepend Text"); 
Storage::disk("oss")->append("dir/path/file.txt", "Append Text");

Storage::disk("oss")->put("dir/path/secret.txt", "My secret", "private");
Storage::disk("oss")->put("dir/path/download.txt", "Download content", ["headers" => ["Content-Disposition" => "attachment;filename=download.txt"]]);

Read

Storage::disk("oss")->url("dir/path/file.txt");
Storage::disk("oss")->temporaryUrl("dir/path/file.txt", \Carbon\Carbon::now()->addMinutes(30));

Storage::disk("oss")->get("dir/path/file.txt"); 

Storage::disk("oss")->exists("dir/path/file.txt"); 
Storage::disk("oss")->size("dir/path/file.txt"); 
Storage::disk("oss")->lastModified("dir/path/file.txt");

Delete

Storage::disk("oss")->delete("dir/path/file.txt");
Storage::disk("oss")->delete(["dir/path/file1.txt", "dir/path/file2.txt"]);

File operation

Storage::disk("oss")->copy("dir/path/file.txt", "dir/path/file_new.txt");
Storage::disk("oss")->move("dir/path/file.txt", "dir/path/file_new.txt");
Storage::disk("oss")->rename("dir/path/file.txt", "dir/path/file_new.txt");

Folder operation

Storage::disk("oss")->makeDirectory("dir/path"); 
Storage::disk("oss")->deleteDirectory("dir/path");

Storage::disk("oss")->files("dir/path");
Storage::disk("oss")->allFiles("dir/path");

Storage::disk("oss")->directories("dir/path"); 
Storage::disk("oss")->allDirectories("dir/path"); 

Use Macro

Storage::disk("oss")->appendObject("dir/path/news.txt", "The first line paragraph.", 0);
Storage::disk("oss")->appendObject("dir/path/news.txt", "The second line paragraph.", 25);
Storage::disk("oss")->appendObject("dir/path/news.txt", "The last line paragraph.", 51);

Storage::disk("oss")->appendFile("dir/path/file.zip", "dir/path/file.zip.001", 0);
Storage::disk("oss")->appendFile("dir/path/file.zip", "dir/path/file.zip.002", 1024);
Storage::disk("oss")->appendFile("dir/path/file.zip", "dir/path/file.zip.003", 1024);
Add Custom Macro
  1. Add Macro

    namespace App\Macros;
    use AlphaSnow\LaravelFilesystem\Aliyun\Macros\AliyunMacro;
    
    class ListBuckets implements AliyunMacro
    {
        // ... 
    }

    Reference code: AppendObject.php

  2. Modify the config

    [
        "macros" => [\App\Macros\ListBuckets::class]
    ]
  3. Use Macro

    Storage::disk("oss")->listBuckets()

Use OssClient

use AlphaSnow\LaravelFilesystem\Aliyun\OssClientAdapter;

$adapter = new OssClientAdapter(Storage::disk("oss"));
$adapter->client()->appendObject($adapter->bucket(), $adapter->path("dir/path/file.txt"), "contents", 0, $adapter->options(["visibility" => "private"]));

Documentation

Issues

Opening an Issue

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].