定制 sp4tz/abacus-xml-exporter 二次开发

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

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

sp4tz/abacus-xml-exporter

Composer 安装命令:

composer require sp4tz/abacus-xml-exporter

包简介

Generic PHP/Symfony XML exporter for Abacus timesheet imports.

README 文档

README

Generic PHP/Symfony XML exporter for Abacus timesheet imports.

The package is designed to stay framework-agnostic. Symfony support is only an optional integration layer.

Basic usage

use Sp4tz\AbacusXmlExporter\Config\ExportConfig;
use Sp4tz\AbacusXmlExporter\Config\MappingConfig;
use Sp4tz\AbacusXmlExporter\Exporter\AbacusTimesheetExporter;
use Sp4tz\AbacusXmlExporter\Mapper\ConfigurableAbacusMapper;
use Sp4tz\AbacusXmlExporter\Model\TimesheetEntry;
use Sp4tz\AbacusXmlExporter\Validator\TimesheetValidator;
use Sp4tz\AbacusXmlExporter\Xml\AbacusXmlBuilder;

$config = new ExportConfig(
    rootNode: 'AbaConnectContainer',
    recordNode: 'TimeSheet',
    strict: true,
);

$mapping = MappingConfig::fromArray([
    'employee_id' => 'PersonNumber',
    'date' => 'Date',
    'duration' => 'Hours',
    'activity_code' => 'Activity',
    'cost_center' => 'CostCenter',
    'project_code' => 'Project',
    'comment' => 'Text',
]);

$exporter = new AbacusTimesheetExporter(
    new TimesheetValidator(),
    new ConfigurableAbacusMapper($mapping, $config),
    new AbacusXmlBuilder(),
    $config,
);

$result = $exporter->export([
    new TimesheetEntry(
        employeeIdentifier: '12345',
        date: new DateTimeImmutable('2026-05-05'),
        duration: 7.5,
        activityCode: 'EXERCICE',
        costCenter: '1000',
        projectCode: null,
        comment: 'Exercice pompier'
    ),
]);

if (!$result->isSuccess()) {
    var_dump($result->getValidationResult()->getErrors());
}

file_put_contents('abacus.xml', $result->getXml());

Symfony configuration example

abacus_xml_exporter:
  company_id: 'ECAP'
  root_node: 'AbaConnectContainer'
  record_node: 'TimeSheet'
  strict: true
  encoding: 'UTF-8'
  date_format: 'Y-m-d'
  decimal_separator: '.'
  skip_null_values: true
  required_fields:
    - employee_id
    - date
    - duration
  mapping:
    employee_id: 'PersonNumber'
    date: 'Date'
    duration: 'Hours'
    activity_code: 'Activity'
    cost_center: 'CostCenter'
    project_code: 'Project'
    comment: 'Text'

Philosophy

Your application entities should not be passed directly to the exporter. Create adapters implementing TimesheetEntryInterface.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固