hexagonlabsllc/laravel-exports 问题修复 & 功能扩展

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

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

hexagonlabsllc/laravel-exports

最新稳定版本:v1.0.0-rc.6

Composer 安装命令:

composer require hexagonlabsllc/laravel-exports

包简介

Comprehensive export feature that utilizes Laravel's model backbone to create customizable exports.

README 文档

README

A powerful, database-driven export system for Laravel applications that provides dynamic, configurable exports without writing code.

Features

  • Database-Driven Configuration - Define exports through database records, not code
  • Dynamic Model Discovery - Auto-import Eloquent models and their relationships
  • Advanced Filtering - Static filters, request-based filters, and collection filters
  • Nested Relationship Support - Export deeply nested data using dot notation
  • Pivot Table Data - Access BelongsToMany pivot attributes via .pivot. notation
  • Transformation Functions - 22 built-in functions for formatting dates, strings, numbers
  • Aggregations - Sum, count, average, min, max, first, last on collections
  • Large Dataset Support - Chunking, streaming, and background job processing
  • Multiple Formats - CSV and JSON out of the box, extensible for more

Documentation

Full documentation is available in the docs directory:

Quick Start

Installation

composer require hexagonlabsllc/laravel-exports

Setup

# Publish configuration and migrations
php artisan vendor:publish --provider="HexagonLabsLLC\LaravelExports\LaravelExportsServiceProvider"

# Run migrations
php artisan migrate

# Import your models with relationships
php artisan export:import-models --deep

# Seed transformation functions
php artisan export:seed-functions

Basic Usage

use HexagonLabsLLC\LaravelExports\Models\{ExportModel, ExportLayout, ExportColumn};
use HexagonLabsLLC\LaravelExports\Services\DynamicExportService;

// 1. Create an export layout
$userModel = ExportModel::where('title', 'User')->first();
$layout = ExportLayout::create([
    'export_model_id' => $userModel->id,
    'title' => 'User Export',
]);

// 2. Define columns
ExportColumn::create([
    'export_layout_id' => $layout->id,
    'title' => 'Name',
    'value_path' => 'name',
    'position' => 1,
]);

ExportColumn::create([
    'export_layout_id' => $layout->id,
    'title' => 'Email',
    'value_path' => 'email',
    'position' => 2,
]);

// 3. Export data
$service = new DynamicExportService();
return $service->downloadAs($layout, 'csv', 'users.csv');

Related Data

Export data from relationships using dot notation:

ExportColumn::create([
    'export_layout_id' => $layout->id,
    'title' => 'Department',
    'value_path' => 'department.name',
    'position' => 3,
]);

Request-Based Filtering

Add dynamic filters controlled by request parameters:

ExportFilter::create([
    'export_layout_id' => $layout->id,
    'export_model_relation_id' => $statusRelation->id,
    'operator' => '=',
    'is_request' => true,
]);

// In your controller
$service->downloadAs($layout, 'csv', 'users.csv', [
    'status' => 'active',
]);

Large Datasets

For large exports, use streaming or background jobs:

// Streaming
return $service->streamAs($layout, 'csv', 'large.csv', [], [], 1000);

// Background job
$exportId = $service->queueExport($layout, 'csv');
$status = ProcessExportJob::getStatus($exportId);

Requirements

  • PHP 8.2+
  • Laravel 12.0+
  • Database with UUID support

Learn More

See the full documentation for:

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固