定制 opencat/project 二次开发

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

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

opencat/project

Composer 安装命令:

composer require opencat/project

包简介

Project manifest and catpack archive format for the OpenCAT Framework

README 文档

README

Project manifest and catpack archive format for the OpenCAT Framework.

Defines catproject.json (the project configuration file) and .catpack (a portable ZIP archive that bundles source files, TM databases, glossaries, and XLIFF). Also provides pluggable stores for persisting segments and skeletons during long-running translation sessions.

Installation

composer require opencat/project

Requires ext-zip. For PostgreSQL stores, install ext-pdo_pgsql.

Project manifest

A catproject.json file describes a translation project:

{
    "name": "Annual Report 2024",
    "sourceLang": "en-US",
    "targetLangs": ["fr-FR", "de-DE"],
    "tm": [
        { "path": "tm/main.db", "readOnly": false }
    ],
    "glossaries": [
        { "path": "glossaries/legal.db", "readOnly": true }
    ],
    "mt": {
        "adapter": "deepl",
        "apiKey": "your-key-here",
        "fillThreshold": 0.75
    },
    "qa": {
        "checks": ["TagConsistencyCheck", "EmptyTranslationCheck", "NumberConsistencyCheck"],
        "failOnSeverity": "error"
    },
    "filters": {
        "docx": {},
        "xlsx": {}
    }
}

Load it with ProjectLoader:

use CatFramework\Project\ProjectLoader;

$manifest = ProjectLoader::load('/path/to/catproject.json');
echo $manifest->name;          // "Annual Report 2024"
echo $manifest->sourceLang;    // "en-US"

Catpack archive

A .catpack file is a ZIP containing:

catproject.json       — project manifest
source/               — original source files
tm/                   — SQLite TM databases (stored uncompressed)
glossaries/           — SQLite glossary databases (stored uncompressed)
xliff/                — generated XLIFF files

Creating a catpack

use CatFramework\Project\CatpackArchive;

$archive = CatpackArchive::create('project.catpack', $manifest);
$archive->addSourceFile('report.docx');
$archive->addTm('tm/main.db', 'main.db');
$archive->addGlossary('glossaries/legal.db', 'legal.db');
$archive->addXliff('report.docx.xlf', 'report.docx.xlf');
$archive->save();

Opening a catpack

$archive = CatpackArchive::open('project.catpack');
$manifest = $archive->getManifest();

$archive->extractTo('/tmp/working-dir');

Segment stores

Segment stores persist SegmentPair objects during processing, so a long-running workflow can be resumed after interruption.

Class Backend Use case
InMemorySegmentStore PHP array Tests and single-request processing
SqliteSegmentStore SQLite file Single-user, no server required
PostgresSegmentStore PostgreSQL Multi-user deployments
use CatFramework\Project\Store\SqliteSegmentStore;

$store = new SqliteSegmentStore('session.db');
$store->persistSegment($pair, $index, $fileId);

$storedPairs = $store->loadSegments($fileId);

All three implement SegmentStoreInterface.

Skeleton stores

Skeleton stores persist the filter skeleton (needed to rebuild the translated file) separately from segments.

Class Backend
FilesystemSkeletonStore Files on disk
DatabaseSkeletonStore SQLite or PostgreSQL

Both implement SkeletonStoreInterface.

MT fill threshold

MtConfig::$fillThreshold controls when MT kicks in. When WorkflowRunner finds a TM match below this score (or no match at all) it calls the MT adapter. Set to 0.0 to disable MT entirely; 0.75 means "use MT when the best TM match is below 75%".

Related packages

  • opencat/coreBilingualDocument, SegmentPair
  • opencat/workflowProjectWorkflowBuilder takes a ProjectManifest and constructs a fully wired WorkflowRunner

opencat/project 适用场景与选型建议

opencat/project 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 opencat/project 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-09