tatter/exports 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tatter/exports

Composer 安装命令:

composer require tatter/exports

包简介

Modular file exports, for CodeIgniter 4

README 文档

README

Modular file exports, for CodeIgniter 4

Coverage Status

Quick Start

  1. Install with Composer: > composer require tatter/exports
  2. Load a handler: $handler = new \Tatter\Exports\Exports\DownloadHandler($myFile);
  3. Run the export: return $handler->process();

Description

Exports defines small classes that can be used to direct files to various destinations. Each class is a handler discoverable by Tatter\Handlers with a distinct set of attributes and its own doProcess() method to do the actual export. Think of an export as something you might see on a "share menu" from a mobile device: supported destinations for a file type.

Installation

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

composer require tatter/exports

Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php.

Usage

You may load Export handlers directly, or use the ExportersFactory to locate them based on their attributes:

// Loaded directly
$handler = new \Tatter\Exports\Exporters\DownloadExporter($myFile);`

// Located by Handlers
$class    = ExporterFactory::find('download');
$exporter = new $class($myFile);

Every handler supports basic setters to provide your file and optional overrides for file metadata:

$exporter->setFile('/path/to/file');
// or...
$file = new \CodeIgniter\Files\File('/path/to/file');
$exporter->setFile($file);

$exporter->setFileName('RenameFileDuringExport.bam');
$exporter->setFileMime('overriding/mimetype');

To execute the export, call its process() method, which will return a ResponseInterface:

use Tatter\Exports\ExporterFactory;

class MyController
{
    public function previewFile($path)
    {
        $class    = ExporterFactory::find('preview');
        $exporter = new $class();

        return $exporter->setFile($path)->process();
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固