Coder Social home page Coder Social logo

aspirantzhang / aliyun-oss-flysystem Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alphasnow/aliyun-oss-flysystem

0.0 0.0 0.0 103 KB

๐Ÿ’พ Flysystem adapter for the Aliyun storage.

Home Page: https://alphasnow.github.io/aliyun-oss-flysystem/

License: MIT License

Shell 0.60% PHP 99.40%

aliyun-oss-flysystem's Introduction

Aliyun OSS Flysystem

๐Ÿ’พ Flysystem Adapter for Aliyun Object Storage Service.

Latest Stable Version Total Downloads License tests Coverage Status

Compatibility

flysystem aliyun-oss-flysystem readme
^3.0 ^3.0 readme
^2.0 ^2.0 readme
^1.0 ^1.0 readme
~1.0.0 ^0.3 readme

Installation

composer require "alphasnow/aliyun-oss-flysystem"

Usage

Initialize

use OSS\OssClient;
use AlphaSnow\Flysystem\Aliyun\AliyunFactory;

$config = [
    "access_key_id" => "**************",             // Required, YourAccessKeyId
    "access_key_secret" => "********************",   // Required, YourAccessKeySecret
    "endpoint" => "oss-cn-shanghai.aliyuncs.com",    // Required, Endpoint
    "bucket" => "bucket-name",                       // Required, Bucket
];

$flysystem = (new AliyunFactory())->createFilesystem($config);

$flysystem->write("file.md", "contents");
$flysystem->writeStream("foo.md", fopen("file.md", "r"));

$fileExists = $flysystem->fileExists("foo.md");
$flysystem->copy("foo.md", "baz.md");
$flysystem->move("baz.md", "bar.md");
$flysystem->delete("bar.md");
$has = $flysystem->has("bar.md");

$read = $flysystem->read("file.md");
$readStream = $flysystem->readStream("file.md");

$flysystem->createDirectory("foo/");
$directoryExists = $flysystem->directoryExists("foo/");
$flysystem->deleteDirectory("foo/");

$listContents = $flysystem->listContents("/", true);
$listPaths = [];
foreach ($listContents as $listContent) {
    $listPaths[] = $listContent->path();
}

$lastModified = $flysystem->lastModified("file.md");
$fileSize = $flysystem->fileSize("file.md");
$mimeType = $flysystem->mimeType("file.md");

$flysystem->setVisibility("file.md", "private");
$visibility = $flysystem->visibility("file.md");

Options

$flysystem->write("file.md", "contents", [
    "options" => ["checkmd5" => false]
]);
$flysystem->write("bar.md", "contents", [
    "headers" => ["Content-Disposition" => "attachment;filename=bar.md"]
]);
$flysystem->write("baz.md", "contents", [
    "visibility" => "private"
]);

Reference

https://github.com/thephpleague/flysystem

License

The MIT License (MIT). Please see License File for more information.

aliyun-oss-flysystem's People

Contributors

alphasnow avatar nnmer avatar gokure avatar fossabot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.