承接 contentreactor/craft-importer 相关项目开发

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

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

contentreactor/craft-importer

Composer 安装命令:

composer require contentreactor/craft-importer

包简介

Data importer for Craft CMS

README 文档

README

Installation

# go to the project directory
cd /path/to/my/project

# tell Composer to load the plugin
composer require contentreactor/craft-importer

# tell Craft to install the required plugin
./craft plugin/install craft-importer

DDEV Installation

If you're using DDEV for your local development, you can install the plugin like so:

cd /path/to/my/project

ddev composer require contentreactor/craft-importer

ddev craft plugin/install craft-importer

Configuration

The Importer uses a jsonField setting to indicate where the content is being stored. Individual importers can also define their own fields. Add configurations to the importers callback of the craft-importer config file config/craft-importer.php. Here's an example:

new \ContentReactor\Importer\Importers\BaseFileImporter(
	section: 'yourSectionHandle',
	importerType: \ContentReactor\Importer\Base\ImporterType::IMPORTER_TYPE_FILE,
	foundStrategy: \ContentReactor\Importer\Base\FoundStrategy::OVERWRITE,
	notFoundStrategy: \ContentReactor\Importer\Base\NotFoundStrategy::DELETE,
	filePath: '/full/system/path/to/your/file.xml', // <- the extension must match the fileType, or be compatible with the MIME type
	fileType: \ContentReactor\Importer\Services\Imports::FILE_XML,
	dataPath: 'comma.separated.nesting.is.supported',
	slugKey: 'slug-key',
	titleKey: 'titleKey',
	primaryKey: 'primary_key', // if 'slug', the `primaryKeyValue` will be tested as slugified
	primaryKeyValue: 'value used to look for existing elements', // relevant for `foundStrategy` and `notFoundStrategy`
),

The same configuration can be replaced by a more defined custom class. The class must implement the \ContentReactor\Importer\Contracts\Importers\ImporterInterface

new \Your\Namespace\Importer(
	section: 'anotherSectionHandle',
	filePath: 'www.example.com/awesome-import-data.json',
	// If the constructor requires only two values, it means the rest of them are being pre-determined or have default fallback values
),

More details and information about each property used by the ImporterInterface can be found in the annotation of the constructor in ContentReactor\Importer\Traits\Importer.

Since the data is intended to be imported and stored in a content field, if it's supposed to be visible, but not editable by content editors, the configuration for NYStudio107's Code Editor Field offers a neat way to make the field readonly.

{
    "readOnly": true
}

contentreactor/craft-importer 适用场景与选型建议

contentreactor/craft-importer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.38k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 contentreactor/craft-importer 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: mit
  • 更新时间: 2025-04-17