csoellinger/php-fon-webservices 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

csoellinger/php-fon-webservices

Composer 安装命令:

composer require csoellinger/php-fon-webservices

包简介

PHP library to handle FinanzOnline web services.

README 文档

README

PHP library to handle (BMF)FinanzOnline webservices.

Source Code Download Package PHP Programming Language Read License Package downloads on Packagist Build status

About

Supported webservices:

  • Session
  • VatID check
  • Databox download
  • File upload
  • Bank data transmission
  • Query data transmission

To be done:

  • Record keeping
  • Cash register

Installation

Install this package as a dependency using Composer.

composer require csoellinger/php-fon-webservices

Usage

Session Webservice

This webservice is needed for all other webservices but can also be used standalone (e.g. for using it with a service which is not supported by this library at the moment). Before you can use it you need to set up a credential class with all necessary informations.

<?php

$tId = 'abcd45678'; // FinanzOnline Teilnehmer-ID
$tUid = 'abcd45678'; // FinanzOnline Teilnehmer-UID (if available, otherwise leave blank)
$benId = 'abcd45678'; // FinanzOnline Benutzer-ID
$benPin = 'abcd45678'; // FinanzOnline Benutzer-PIN

$credential = new FonCredential($tId, $tUid, $benId, $benPin);

// Initialize
$sessionWs = new SessionWs($credential);

// Login
$sessionWs->login();

// Get session id
$sessionId = $sessionWs->getID();

// optional: logout. Not really needed cause you will be logged off at class destruct.
$sessionWs->logout();

VatID Check Webservice

Check a vat id (value added tax identification) for validity at two levels. First only return valid or not valid, second also return the company name and address if available.

// Initialize with previous created session webservice

/** @var SessionWs $sessionWs */
$checkVatIdWs = new VatIdCheckWs($sessionWs);

// Check at level one only returns valid
var_dump($checkVatIdWs->check('ATU36975500'));
/**
 * CSoellinger\FonWebservices\Result\VatIdCheck\ValidLevelOne
 *   valid => (bool) true
 */

// At level two you also get name and address of the organisation if available
var_dump($checkVatIdWs->check('ATU36975500', 2));
/**
 * CSoellinger\FonWebservices\Result\VatIdCheck\ValidLevelTwo
 *   name => (string) 'McDonald's Franchise GmbH'
 *   address => (string) 'Campus 21,Liebermannst A01601 AT-2345 Brunn am Gebirge'
 *   valid => (bool) true
 */

Databox Download Webservice

// Initialize with previous created session webservice

/** @var SessionWs $sessionWs */
$databoxDownloadWs = new DataboxDownloadWs($sessionWs);

// Get a list of your databox
$databoxList = $databoxDownloadWs->get();
var_dump($databoxList);
/**
 * array
 *   0 =>
 *     CSoellinger\FonWebservices\Result\DataboxDownload\ListItem
 *       stnr => (string) '99 999/9999'
 *       name => (string) 'Mustermann Max'
 *       anbringen => (string) 'STB-ZUSI'
 *       zrvon => (string) ''
 *       zrbis => (string) ''
 *       datbesch => (string) '2019-07-15+02:00'
 *       erltyp => (string) 'B'
 *       fileart => (string) 'PDF'
 *       ts_zust => (string) '2020-11-02T07:04:10.044+01:00'
 *       applkey => (string) '2019-07-15-11.45.07.000000'
 *       filebez => (string) '99_9999999_B_2008-11-20_2008-11-20-100948804630.PDF'
 *       status => (string) ''
 */

// Get one entry by the applkey
$entry = $databoxDownloadWs->getEntry($databoxList[0]->applkey);
var_dump($entry);
/**
 * (string) 'JVBERi0xLjQNJeLjz9MNCjYgMCBvYmoNPDwvTGluZWFyaXplZCAxL0wgNTk1Ny9PIDgvRSAxNzAzL'...
 */

Example(s)

The easiest way to start the examples is to start a PHP server:

php -S localhost:8005 --docroot ./examples

Now open your browser and go to http://localhost:8005

Setup

composer install

Quality Tools

This project uses modern PHP tooling for code quality:

Testing

  • Pest - Modern testing framework with expressive syntax
    composer test              # Run Pest tests
    composer test:coverage     # Run tests with coverage report

Code Style & Formatting

  • PHP-CS-Fixer - Automatic code style fixer (PSR-12)
    composer format            # Auto-fix code style
    composer format:check      # Check code style (for CI)

Static Analysis

  • PHPStan - Static analysis tool (max level)
  • Psalm - Static analysis and type checker (level 1)
    composer analyse           # Run PHPStan + Psalm
    composer analyse:phpstan   # Run PHPStan only
    composer analyse:psalm     # Run Psalm only

Automated Refactoring

  • Rector - Automated code refactoring and upgrades
    composer rector            # Check for refactoring opportunities
    composer rector:fix        # Apply automated refactorings

Combined Checks

composer lint              # Check PHP syntax (parallel-lint)
composer check             # Run all quality checks (lint + format + analyse)

Multi-Version Testing with Podman

Test across all supported PHP versions using Podman Compose:

# Build all containers
podman-compose build

# Install/update dependencies (run after composer.json changes)
podman-compose run --rm php82 composer update

# Run tests on a specific PHP version
podman-compose run --rm php81 composer test
podman-compose run --rm php82 composer test
podman-compose run --rm php83 composer test
podman-compose run --rm php84 composer test

# Test all versions at once
bash bin/test-all-versions.sh

Supported PHP versions: 8.3, 8.4

Note: After modifying composer.json, you need to run composer update inside a container to update dependencies before running tests.

Documentation

API documentation is available in docs/api/

Contributing

Contributions are welcome! To contribute, please familiarize yourself with CONTRIBUTING.md.

If you found a bug or have an idea feel free to post it here on github.

Copyright and License

The csoellinger/php-fon-webservices library is free and unencumbered software released into the public domain. Please see UNLICENSE for more information.

csoellinger/php-fon-webservices 适用场景与选型建议

csoellinger/php-fon-webservices 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 94 次下载、GitHub Stars 达 4, 最近一次更新时间为 2021 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 csoellinger/php-fon-webservices 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2021-03-08