sinemacula/laravel-resource-exporter 问题修复 & 功能扩展

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

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

sinemacula/laravel-resource-exporter

最新稳定版本:v1.1.2

Composer 安装命令:

composer require sinemacula/laravel-resource-exporter

包简介

A versatile Laravel package for exporting JsonResource and JsonResourceCollection objects into various formats with customizable drivers.

README 文档

README

Latest Stable Version Build Status StyleCI Maintainability Test Coverage Total Downloads

Laravel Resource Exporter is a versatile package that enables seamless conversion of Laravel JsonResource and JsonResourceCollection objects into various exportable formats. The package is designed with extensibility in mind, allowing you to easily add custom export formats via a driver-based architecture.

Features

  • Format Flexibility: Export your resources to various formats using customizable drivers, making it easy to extend or adapt to new formats.
  • Driver-Based Architecture: Each export format is handled by a dedicated driver class, ensuring clean, maintainable, and extendable code.
  • Facade Support: Utilize an intuitive facade for easy access to export functionality, streamlining the process of converting resources.

Supported Drivers

  • CSV
  • XML

Installation

To install the Laravel Resource Exporter, run the following command in your project directory:

composer require sinemacula/laravel-resource-exporter

Configuration

After installation, publish the package configuration to customize it according to your needs:

php artisan vendor:publish --provider="SineMacula\Exporter\ExporterServiceProvider"

This command publishes the package configuration file to your application's config directory, allowing you to modify aspects such as the available export formats, driver configurations, and more.

Usage

The Laravel Resource Exporter provides an easy-to-use facade for exporting resources. Below is an example of how to export a resource or a collection:

use SineMacula\Exporter\Facades\Exporter;
use App\Http\Resources\YourResource;

// Export an item as CSV
$csv = Exporter::format('csv')->exportItem(new YourResource($item));

// Export a collection as XML
$xml = Exporter::format('xml')->exportCollection(YourResource::collection($collection));

Contributing

Contributions are welcome and will be fully credited. We accept contributions via pull requests on GitHub.

Security

If you discover any security related issues, please email instead of using the issue tracker.

License

The Laravel Resource Exporter repository is open-sourced software licensed under the Apache License, Version 2.0.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固