LaravelPackages.net
Acme Inc.
Toggle sidebar
jasonmann/laravel-filesystem-upyun

A Upyun storage filesystem for Laravel.

55
0
1.1.0
About jasonmann/laravel-filesystem-upyun

jasonmann/laravel-filesystem-upyun is a Laravel package for a upyun storage filesystem for laravel.. It currently has 0 GitHub stars and 55 downloads on Packagist (latest version 1.1.0). Install it with composer require jasonmann/laravel-filesystem-upyun. Discover more Laravel packages by jasonmann or browse all Laravel packages to compare alternatives.

Last updated

laravel-filesystem-upyun

A Upyun storage filesystem for Laravel..

扩展包要求

  • PHP >= 7.0

安装

$ composer require jasonmann/laravel-filesystem-upyun -vvv

配置

Laravel

  1. 将服务提供者 Jasonmann\LaravelFilesystem\Upyun\UpyunServiceProvider::class 注册到 config/app.php 文件:
'providers' => [
    // Other service providers...
   Jasonmann\LaravelFilesystem\Upyun\UpyunServiceProvider::class,
],
  1. config/filesystems.php 配置文件中添加你的新驱动
<?php
return [
   'disks' => [
        //...
        'upyun' => [
                        'driver'        => 'upyun', 
                        'bucket'        => 'your-bucket-name',// 服务名字
                        'operator'      => 'oparator-name', // 操作员的名字
                        'password'      => 'operator-password', // 操作员的密码
                        'domain'        => 'xxxxx.b0.upaiyun.com', // 服务分配的域名
                        'protocol'     => 'https', // 服务使用的协议,如需使用 http,在此配置 http
                    ],
        //...
    ]
];

Lumen

  1. 将服务提供者 Jasonmann\LaravelFilesystem\Upyun\UpyunServiceProvider::class 注册到 bootstrap/app.php 文件:
$app->register(\Jasonmann\LaravelFilesystem\Upyun\UpyunServiceProvider::class);
  1. config/filesystems.php 配置文件中添加你的新驱动
<?php
return [
   'disks' => [
        //...
        'upyun' => [
                        'driver'        => 'upyun', 
                        'bucket'        => 'your-bucket-name',// 服务名字
                        'operator'      => 'oparator-name', // 操作员的名字
                        'password'      => 'operator-password', // 操作员的密码
                        'domain'        => 'xxxxx.b0.upaiyun.com', // 服务分配的域名
                        'protocol'     => 'https', // 服务使用的协议,如需使用 http,在此配置 http
                    ],
        //...
    ]
];

使用

bool $flysystem->write('file.md', 'contents');

bool $flysystem->writeStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));

bool $flysystem->update('file.md', 'new contents');

bool $flysystem->updateStram('file.md', fopen('path/to/your/local/file.jpg', 'r'));

bool $flysystem->rename('foo.md', 'bar.md');

bool $flysystem->copy('foo.md', 'foo2.md');

bool $flysystem->delete('file.md');

bool $flysystem->has('file.md');

string|false $flysystem->read('file.md');

array $flysystem->listContents();

array $flysystem->getMetadata('file.md');

int $flysystem->getSize('file.md');

string $flysystem->getUrl('file.md'); 

string $flysystem->getMimetype('file.md');

int $flysystem->getTimestamp('file.md');
// 获取 upyun 实例 实例中可用方法,可以参照 https://github.com/JasonMann1993/upyun-php-sdk/blob/master/src/Upyun/Upyun.php
obj $flysystem->kernel();

License

MIT

Comments