承接 rechtlogisch/steuernummer 相关项目开发

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

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

rechtlogisch/steuernummer

Composer 安装命令:

composer require rechtlogisch/steuernummer

包简介

Normalize, denormalize and validate German tax numbers (Steuernummer)

README 文档

README

Recht logisch Steuernummer banner image

Latest Version on Packagist Tests Total Downloads

steuernummer

Normalize, denormalize and validate German tax numbers (Steuernummer)

Formats bidirectionally German tax numbers originating from tax office letters (German: Bescheidformat) or the ELSTER-Format (German: bundeseinheitliches ELSTER-Steuernummerformat) and validates it.

Based on the official ELSTER documentation (chapters: 3 - 7; as of 2025-02-24). Inspired by kontist/normalize-steuernummer and kontist/denormalize-steuernummer.

Note

This package validates solely the syntax and check digit of the provided input. It does not confirm, that the provided Steuernummer was assigned to any entity. Please contact the responsible tax office in case of any doubts concerning the correctness of your Steuernummer.

Installation

You can install the package via composer:

composer require rechtlogisch/steuernummer

Usage

Normalize

normalizeSteuernummer('21/815/08150', 'BE'); // => '1121081508150'

or

use Rechtlogisch\Steuernummer\Normalize;

(new Normalize('21/815/08150', 'BE'))
    ->returnElsterSteuernummerOnly(); // => '1121081508150'

Tip

You can use run() instead, if you want more details.

Denormalize

denormalizeSteuernummer('1121081508150'); // => '21/815/08150'

or

use Rechtlogisch\Steuernummer\Denormalize;

(new Denormalize('1121081508150'))
    ->returnSteuernummerOnly(); // => '21/815/08150'

Tip

You can use run() instead, if you want more details.

Details

You can additionally control the result with setting returnWithFederalState: true. When set true information which federal state the Steuernummer origins from is being added to result.

denormalizeSteuernummer('1121081508150', returnWithFederalState: true);
// [
//   'steuernummer' => '21/815/08150',
//   'federalState' => 'BE',
// ]

or

use Rechtlogisch\Steuernummer\Denormalize;

(new Denormalize('1121081508150'))
    ->returnWithFederalState(); 
// [
//   'steuernummer' => '21/815/08150',
//   'federalState' => 'BE',
// ]

Tip

You can use run() instead, if you want even more details.

Validate

You can validate an input in the so called ELSTER-Steuernummerformat (13-digits):

isElsterSteuernummerValid('1121081508150'); // => true

or by providing the so called Bescheidformat (length varies) together with the federal state:

isSteuernummerValid('21/815/08150', 'BE'); // => true

Note

There are two functions isElsterSteuernummerValid() and isSteuernummerValid() depending on the format of your input.

Alternative

use Rechtlogisch\Steuernummer\Validate;

(new Validate('1121081508150'))
    ->run() // ValidationResult::class
    ->isValid(); // => true

The federal state is determined by the first digits of the ELSTER-Format, you can provide it as the second parameter to override the auto-determination:

use Rechtlogisch\Steuernummer\Validate;

(new Validate('1121081508150', 'BE'))
    ->run() // ValidationResult::class
    ->isValid(); // => true

Errors

You can get a list of errors explaining why the provided input is invalid. The run() method on each class returns a DTO with a getErrors() method.

Note

The keys of getErrors() hold the stringified reference to the exception class. You can check for a particular error by comparing to the ::class constant. For example: Rechtlogisch\Steuernummer\Exceptions\InvalidElsterSteuernummerLength::class.

Validation errors

use Rechtlogisch\Steuernummer\Validate;

(new Validate('123456789012', 'BE'))
    ->run() // ValidationResult::class
    ->getErrors();
// [
//   'Rechtlogisch\Steuernummer\Exceptions\InvalidElsterSteuernummerLength'
//    => 'elsterSteuernummer must be 13 digits long. You provided: 12 digits.'
// ]

Normalization errors

use Rechtlogisch\Steuernummer\Normalize;

(new Normalize('123456789', 'BE'))
    ->run() // NormalizationResult::class
    ->getErrors();
// [
//   'Rechtlogisch\Steuernummer\Exceptions\InvalidSteuernummerLength'
//    => 'steuernummer for BE must contain exactly 10 digits. You provided: 9 digits.'
// ]

Denormalization errors

use Rechtlogisch\Steuernummer\Denormalize;

(new Denormalize('123456789012'))
    ->run() // DenormalizationResult::class
    ->getErrors();
// [
//   'Rechtlogisch\Steuernummer\Exceptions\InvalidElsterSteuernummerLength'
//    => 'elsterSteuernummer must be 13 digits long. You provided: 12 digits.'
// ]

Note

All *Result::class extend the ResultDto.

Supported tax offices

By default, tax office codes (German: Bundesfinanzamtsnummer - short BUFA) included in the ELSTER ERiC libraries are supported by this package. Currently, based on ERiC 41.5.4. You'll find the list in src/Bufas.php.

The list includes test BUFAs, which are invalid in production. It is recommended to disable them in production with the following environment variable:

STEUERNUMMER_PRODUCTION=true

or in PHP:

putenv('STEUERNUMMER_PRODUCTION=true');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

If you discover any security-related issues, please email open-source@rechtlogisch.de instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

rechtlogisch/steuernummer 适用场景与选型建议

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

它主要适用于以下技术方向: 「validate」 「normalize」 「germany」 「denormalize」 「tax number」 「rechtlogisch」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-09