承接 enoliu/thinkphp-oss 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

enoliu/thinkphp-oss

Composer 安装命令:

composer require enoliu/thinkphp-oss

包简介

Thinkphp Flysystem for the AliYun OSS storage.

README 文档

README

Thinkphp Flysystem for the AliYun OSS storage..

Installing

$ composer require enoliu/thinkphp-oss -vvv

config

添加oss配置到文件配置config/filesystem.php

<?php

return [
    // 默认磁盘
    'default' => env('filesystem.driver', 'oss'),
    // 磁盘列表
    'disks'   => [
        'local'  => [
            'type' => 'local',
            'root' => app()->getRuntimePath() . 'storage',
        ],
        'public' => [
            // 磁盘类型
            'type'       => 'local',
            // 磁盘路径
            'root'       => app()->getRootPath() . 'public/storage',
            // 磁盘路径对应的外部URL路径
            'url'        => '/storage',
            // 可见性
            'visibility' => 'public',
        ],
        // 更多的磁盘配置信息
        'oss'    => [
            'type'         => 'oss',
            'accessId'     => 'LT******JwHf',
            'accessSecret' => 'MfSs*******cOzpP',
            'bucket'       => 'lo***e52',
            'endPoint'     => 'oss-cn-beijing.aliyuncs.com',
            // 'timeout'        => 3600,
            // 'connectTimeout' => 10,
            // 'isCName'        => false,
            // 'token'          => '',
            // 'useSSL'         => false    // 是否启用ssl
        ]
    ],
];

Usage

<?php
namespace app\controller;

use app\BaseController;
use think\facade\Filesystem;

class Upload extends BaseController
{
    public function demo()
    {
        $file = $this->request->file('file');

        $path1 = Filesystem::putFile('test/path', $file);
        $path2 = Filesystem::putFileAs('test/path', $file, $file->getOriginalName());
        $path3 = Filesystem::disk('oss')->putFile('test/path', $file);  // 指定disk驱动

        $url1 = Filesystem::getAdapter()->getUrl($path1);
        $url2 = Filesystem::getAdapter()->getUrl($path2);
        $url3 = Filesystem::disk('oss')->getAdapter()->getUrl($path3);

        return compact('path1','url1', 'path2', 'url2', 'path3', 'url3');
    }
}

Response

{
    "path1": "test/path/20210122/56737eece60bd855c78603848edcb10a.json",
    "url1": "http://lo***e52.oss-cn-beijing.aliyuncs.com/test/path/20210122/56737eece60bd855c78603848edcb10a.json",
    
    "path2": "test/path/item.json",
    "url2": "http://lo***e52.oss-cn-beijing.aliyuncs.com/test/path/item.json",
    
    "path3": "test/path/20210122/56737eece60bd855c78603848edcb10a.json",
    "url3": "http://lo***e52.oss-cn-beijing.aliyuncs.com/test/path/20210122/56737eece60bd855c78603848edcb10a.json"
}

More

use think\facade\Filesystem;

$config = [
    'dir'      => 'upload/tmp',
    'expire'   => 60 * 60,
    'callback' => 'http://www.baidu.com',
    'maxSize'  => 10 * 1024 * 1024
];
array Filesystem::getAdapter()->directUpload($config);

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT

enoliu/thinkphp-oss 适用场景与选型建议

enoliu/thinkphp-oss 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 01 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 enoliu/thinkphp-oss 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 enoliu/thinkphp-oss 我们能提供哪些服务?
定制开发 / 二次开发

基于 enoliu/thinkphp-oss 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-22