tadasei/backend-excel-utils 问题修复 & 功能扩展

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

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

tadasei/backend-excel-utils

Composer 安装命令:

composer require tadasei/backend-excel-utils

包简介

A package that provides stub utilities for usage with laravel excel

README 文档

README

This package provides stub utilities for working with Laravel Excel or Fast Excel. It simplifies the creation of Excel exports by offering pre-built components, including a model for metadata and tracking, as well as traits for custom styles and cell data types.

Features

  • Export Model:
    Provides metadata and tracking for Excel exports:

    • Export type (linked to the Laravel Excel export class).
    • User requesting the export.
    • Request time and timezone.
    • Processing timestamp (processed_at).
    • Integration with tadasei/backend-file-management for file metadata.
  • Traits for Laravel Excel Export Classes:

    • BoldHeadings: Adds bold styling to heading cells.
    • CenteredCells: Centers the content of cells.
    • CustomCellDataTypes: Handles custom cell data types, including the phoneNumber type to preserve leading + in phone numbers.
  • Artisan Command for Quick Setup:
    Generates the following stubs ready for customization:

    • Migration: database/migrations/YYYY_MM_DD_HHMMSS_create_exports_table.php
    • Model: app/Models/Export.php
    • Traits:
      • app/Traits/BoldHeadings.php
      • app/Traits/CenteredCells.php
      • app/Traits/CustomCellDataTypes.php

Installation

Requirements

Steps

  1. Install the package via Composer:

    composer require tadasei/backend-excel-utils --dev
  2. Run the installation command to generate stubs:

    php artisan excel-utils:install

    This will generate:

    • database/migrations/YYYY_MM_DD_HHMMSS_create_exports_table.php
    • app/Models/Export.php
    • app/Traits/BoldHeadings.php
    • app/Traits/CenteredCells.php
    • app/Traits/CustomCellDataTypes.php

Usage

Export Model

The Export model tracks metadata for your exports and integrates with the File model from the tadasei/backend-file-management package. Key attributes include:

  • type: The Laravel Excel export class that triggers the export.
  • user_id: The ID of the user who requested the export.
  • requested_at: The timestamp of the export request.
  • timezone: The user's timezone at the time of the request.
  • processed_at: A nullable timestamp representing when the export was processed. It remains null if the export is pending or in progress.

Feel free to extend or customize the Export model to suit your application.

Traits

1. BoldHeadings

Use the BoldHeadings trait in your Laravel Excel export classes to apply bold styling to heading cells. Implement it with Laravel Excel's styles() method:

use App\Traits\BoldHeadings;

class ExampleExport implements FromCollection, WithStyles
{
    use BoldHeadings;

    // Other methods...
}

2. CenteredCells

Apply centered alignment to cells using the CenteredCells trait:

use App\Traits\CenteredCells;

class ExampleExport implements FromCollection, WithStyles
{
    use CenteredCells;

    // Other methods...
}

3. CustomCellDataTypes

Support custom cell data types with the CustomCellDataTypes trait, such as preserving leading + in phone numbers:

use App\Traits\CustomCellDataTypes;

class ExampleExport implements FromCollection, WithCustomValueBinder
{
    use CustomCellDataTypes;

    // Other methods...
}

Customization

The generated files are stubs intended as a starting point. You can modify them to better fit your application's requirements.

Contributing

Contributions are welcome! If you have suggestions, bug reports, or feature requests, please open an issue on the GitHub repository.

License

This package is licensed under the MIT License.

tadasei/backend-excel-utils 适用场景与选型建议

tadasei/backend-excel-utils 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 75 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 12 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「excel」 「backend」 「utils」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 tadasei/backend-excel-utils 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-06