承接 basilicom/xml-tool-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

basilicom/xml-tool-bundle

Composer 安装命令:

composer require basilicom/xml-tool-bundle

包简介

This Bundle provides xml (export) tools for Pimcore.

README 文档

README

Adds commands for dealing with XML data. For now, parts of the Object tree can be exported recursively, retaining the hierarchy.

Exports can be triggered by a console command and written to stdout, a file or an pimcore asset.

If enabled, exports can be made available via a REST API, too.

Table of contents

License

GPLv3 - see: LICENSE

Requirements

  • PHP >= 7.1
  • Pimcore >= 5.0.0
  • XSL PHP extension for --xslt option support

Installation

  1. Install the bundle using composer composer require basilicom/xml-tool-bundle dev-master.
  2. Execute bin/console pimcore:bundle:enable BasilicomXmlToolBundle

Configuration

n/a

Console Usage

Use the export command to export command to export the Object tree, example for path /foo:

    bin/console basilicom:xmltool:export /foo

Example output:

Note: The Object tree /foo contains in the example a single Object of the Object Class Bar with a single Input property of name.

Exporting tree of Objects starting at /foo
<?xml version="1.0"?>
<root id="1" type="folder" key="" class="Folder">
  <:children>
    <Bar id="4" type="object" key="baaaar" class="Bar">
      <name><![CDATA[bar]]></name>
    </Bar>
  </:children>
</root>

Complex example:

  • do not export the attributes / fields of objects attached via relations
  • export variants of objects, too
  • change the name of the root node to 'Products'
  • apply a sample xslt
  • export to a pimcore asset /output/my-export.xml
./bin/console basilicom:xmltool:export --omit-relation-object-fields --include-variants --root=products --asset=/output/my-export.xml --xslt sample.xsl /exp

Sample XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <objects>
    <xsl:for-each select="//Leaf">
      <object>
        <name><xsl:value-of select="name"/></name>
      </object>
    </xsl:for-each>
    </objects>
  </xsl:template>
</xsl:stylesheet>

For all options (writing to a file, etc.), see:

    bin/console basilicom:xmltool:export --help

Usage: REST API

In order to enable the REST API, place a configuration file in app/config/local/xmltool.yml:

basilicom_xml_tool:
  api:
    enabled: true
    endpoints:
      test1:
        token: secrettoken0815
        root: Products # Root name of the exported XML file
        path: /export/products # Path to the exporting objects
        xslt: ../sample.xsl
        include_variants: true
        omit_relation_object_fields: true
      test2:
        path: /sample/obj/path

This example enables two endpoint URLs:

Limitations

Only a few field types are supported for now:

  • input
  • select
  • wysiwyg
  • textarea
  • date
  • datetime
  • ManyToManyObjectRelation
  • color
  • rgbaColor
  • localizedFields

To extend the supported types, implement a getForType* method in Service/Xml.php.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2020-07-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固