定制 chipk4/selectel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chipk4/selectel

Composer 安装命令:

composer require chipk4/selectel

包简介

Laravel Package for Selectel API cloud storage (selectel.com)

README 文档

README

GitHub release Software License

This package provides an easy way to integrate Selectel Cloud Storage API with Laravel 5. Here are some examples of what you can do with the package:

SelectelApi::storageInfo();

//You may use virtual folders like 'newFolder/newFileName.jpg'
SelectelApi::storeFile('container', 'filePath/1243.jpg', 'newFileName.jpg')

SelectelApi::containerInfo('your_container')

SelectelApi::storageContainerList()

/*
* You can use private or public container type
* Public container present by default
* For private container use 
*/
SelectelApi::getFile('container', 'fileName', true);
//For public container
SelectelApi::getFile('container', 'fileName');

SelectelApi::containerFileList('container_name');

//If you want to do something else, you can get an instance of the underlying API:
SelectelApi::getApi();

Installation

You can install this package via Composer using:

composer require chipk4/selectel

You must also install this service provider.

// config/app.php
'providers' => [
    ...
    Chipk4\Selectel\SelectelApiServiceProvider::class,
    ...
];

If you want to make use of the facade you must install it as well.

// config/app.php
'aliases' => [
    ..
    'SelectelApi' => Chipk4\Selectel\SelectelApiFacade::class,
];

To publish the config file to app/config/selectel-api.php run:

php artisan vendor:publish --provider="Chipk4\Selectel\SelectelApiServiceProvider"

This will publish a file selectel-api.php in your config directory with the following contents:

return [
    /*
     * This is agreement number from system
     */
    'authUser' => env('SELECTEL_LOGIN'),

    /*
     * Password for cloud storage service.
     * Note: it's different with account password
     */
    'authKey' => env('SELECTEL_PASSWORD'),

    /*
     * API url
     */
    'apiUrl' => 'https://auth.selcdn.ru/',

    /*
     * Default value for request timeout
     */
    'timeout' => 10,

    /*
     * Default storage url
     */
    'storageUrl' => env('SELECTEL_STORAGE_URL', ''),

    /*
     * Response view
     * Can be in json or xml
     */
    'returnView' => env('SELECTEL_RETURN_VIEW', 'json'),
    
];

Usage

With Facade

  use SelectelApi;
  
  SelectelApi::getFile('container', 'fileName');

With Service Container

    use Chipk4\Selectel\CloudStorage;
    
    public function test(CloudStorage $storage) 
    {
        $storage->getFile('container', 'fileName');
    }

License

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

统计信息

  • 总下载量: 185
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-21