定制 vinorcola/import-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vinorcola/import-bundle

Composer 安装命令:

composer require vinorcola/import-bundle

包简介

Bundle providing tools for importing and mapping a file.

README 文档

README

A bundle to import data from CSV or Excel files, letting the user map the columns of its file to the required fields for your process.

Configuration

Setup a temporary directory in which the uploaded files will be stored temporarily.

Setup as many imports as you want by configuring:

  • the route prefix (several routes are generated for each import process)
  • the mapping (the required columns for your process)
  • The process service (which must implement Vinorcola\ImportBundle\Model\ImportConsumerInterface).
# config/packages/vinorcola_import.yaml

vinorcola_import:
    temporaryDirectory: "%kernel.project_dir%/document-storage/tmp"
    imports:
        company_import:
            route_prefix:
                name: import.company.
                url: /company/import
            mapping: [ nationalIdentifier, companyName, address, city ]
            service: App\Model\CompanyImportHandler
        contact_import:
            route_prefix:
                name: import.contact.
                url: /contact/import
            mapping: [ firstName, lastName, emailAddress, phoneNumber ]
            service: App\Model\ContactImportHanlder
# config/routes/vinorcola_import.yaml

import_routes:
    resource: '@VinorcolaImportBundle/Controller/'
    type: vinorcola_import

Then, the consume method of your process service will be called for line of data in the user's file, providing an array with the mapped columns and the line index:

public function consume(array $values, int $lineIndex): void;

For example, in the App\Model\CompanyImportHandler, the consume method will be called with a $values array containing the following keys:

  • nationalIdentifier
  • companyName
  • address
  • city

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固