承接 ruvents/spiral-upload 相关项目开发

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

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

ruvents/spiral-upload

最新稳定版本:0.1.0

Composer 安装命令:

composer require ruvents/spiral-upload

包简介

Upload management

README 文档

README

Upload management package with misc helpers.

Installation

composer require ruvents/spiral-upload

Then add UploadBootloader to your App.php:

use Ruvents\SpiralUpload\UploadBootloader;

class App extends Kernel
{
    protected const LOAD = [
        ...
        UploadBootloader::class,
    ]
}

Configuration

Put the following code into file app/config/upload.php:

<?php

declare(strict_types=1);

return [
    'uploadClass' => Upload::class, // Custom UploadInterface implementation class.
    'urlPrefix' => 'https://foo.bar/uploads/', // Public URL to uploads. Example:
    // https://foo.bar/uploads/f8/some-upload.png -- full URL to upload
    // https://foo.bar/uploads -- URL prefix
    // f8/some-upload.png -- relative path to upload
];

Use

Use UploadManager for upload-relative tasks:

public function manageUploads(UploadManager $manager)
{
    // Create upload from file path.
    $upload = $manager->create('/path/to/file.txt', 'file.txt');

    // Create upload from resource.
    $upload = $manager->create($handle = fopen('/path/to/file.txt', 'r'), 'file.txt');
    fclose($handle);

    // Or from UploadedFileInterface.
    $stream = clone $uploadedFile->getStream();
    $upload = $manager->create($stream->detach(), 'file.txt');

    // Get full URL of upload.
    $url = $manager->url($upload);

    // Delete stored file associated with upload.
    $manager->delete($upload);
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-23