jttech / sie
用于导出至瑞典SIE格式的库。目前仅支持部分规范,如导出至SIE4(验证/交易数据)。
2.0
2024-08-24 15:10 UTC
Requires
- php: >=8.2
- ext-iconv: *
Requires (Dev)
- phpstan/phpstan: ^1.11
- phpstan/phpstan-phpunit: ^1.4
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^11.2
- rector/rector: ^1.2
- spaze/phpstan-disallowed-calls: ^3.4
- symplify/easy-coding-standard: ^12.3
This package is auto-updated.
Last update: 2024-09-01 14:30:21 UTC
README
关于
SIEPHP是一个库,它允许将账务数据导出为瑞典SIE格式。有关SIE的更多信息,请参阅http://www.sie.se/
目前仅支持部分规范,如导出至SIE4(验证/交易数据)。将来也可以编写SIE的加载类,并支持SIE标准中更多功能。
它基于简单的数据类构建,这些类代表SIE标准模型中的公司/验证/交易。它还附带一个可以将数据导出到SIE格式的dumper类。
安装
使用以下命令安装最新稳定版本
$ composer require jttech/sie ^2.0
升级
有关升级方法的详细信息,请参阅UPGRADE.md
使用方法
examples/包含一些关于如何使用SIE-PHP的示例。这是examples/simple.php
// create a company $company = (new SIE\Data\Company()) // set company name ->setCompanyName('My company') // add a verification series ->addVerificationSeries(new SIE\Data\VerificationSeries()) // add two accounts ->addAccount((new SIE\Data\Account(1511))->setName('Kundfordringar')) ->addAccount((new SIE\Data\Account(3741))->setName('Öresutjämning')) ; // add a verification with two transactions $verification = (new SIE\Data\Verification(591000490))->setDate('20150105') ->addTransaction( (new SIE\Data\Transaction()) ->setAccount($company->getAccount(1511)) ->setAmount(-0.24) ) ->addTransaction( (new SIE\Data\Transaction()) ->setAccount($company->getAccount(3741)) ->setAmount(0.24) ) ; // add the verification to the company $company->getVerificationSeriesAll()[0]->addVerification($verification); // validate data, will throw Exception if invalid data $company->validate(); $dumper = new SIE\Dumper\SIEDumper(); $output = $dumper->dump($company); echo $output;
它将生成以下输出(PC8/CP437编码)
#FLAGGA 0
#FORMAT PC8
#SIETYP 4
#PROGRAM "SIE-PHP exporter" 1.0
#GEN 20150921
#FNAMN "My company"
#KONTO 1511 Kundfordringar
#KONTO 3741 Öresutjämning
#VER A 591000490 20150105
{
#TRANS 1511 {} -0.24 20150105
#TRANS 3741 {} 0.24 20150105
}
有关自定义TSV到SIE转换器的详细信息,请参阅examples/TSVtoSIE.php,它从TSV文件中加载数据。
开发
SIEPHP附带docker compose,以便于开发,构建开发docker容器,运行
docker compose up --build -d
构建完成后,进入php 8.2或8.3容器
docker exec -it siephp-php83 bash docker exec -it siephp-php84 bash
所有工具都作为composer脚本添加,首先安装依赖项
composer install
然后,您可以使用代码风格(cs)命令来检查/修复问题,使用rector执行自动重构,或使用phpunit。
composer cs-check composer cs-fix composer rector-check composer rector-fix composer phpunit
作者
Johan Wilfer - johan [at] jttech.se - http://jttech.se
许可证
SIE-PHP采用MIT许可证 - 有关详细信息,请参阅LICENSE文件
感谢
- Mitronic AB (https://www.mitronic.se/) 资助了版本1的开发
- Sirvoy (https://sirvoy.com) 资助了版本2的开发
有疑问吗?
请发送电子邮件至johan [at] jttech.se