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
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-05