PHP code example of jasonmann / laravel-filesystem-upyun

1. Go to this page and download the library: Download jasonmann/laravel-filesystem-upyun library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jasonmann / laravel-filesystem-upyun example snippets


'providers' => [
    // Other service providers...
   Jasonmann\LaravelFilesystem\Upyun\UpyunServiceProvider::class,
],


return [
   'disks' => [
        //...
        'upyun' => [
                        'driver'        => 'upyun', 
                        'bucket'        => 'your-bucket-name',// 服务名字
                        'operator'      => 'oparator-name', // 操作员的名字
                        'password'      => 'operator-password', // 操作员的密码
                        'domain'        => 'xxxxx.b0.upaiyun.com', // 服务分配的域名
                        'protocol'     => 'https', // 服务使用的协议,如需使用 http,在此配置 http
                    ],
        //...
    ]
];

$app->register(\Jasonmann\LaravelFilesystem\Upyun\UpyunServiceProvider::class);


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();