PHPackages                             csoellinger/php-laravel-fon-ws - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. csoellinger/php-laravel-fon-ws

ActiveLibrary[API Development](/categories/api)

csoellinger/php-laravel-fon-ws
==============================

Laravel integration for the Austrian FinanzOnline (FON) web services

01PHPCI passing

Since Dec 8Pushed 5mo agoCompare

[ Source](https://github.com/CSoellinger/php-laravel-fon-ws)[ Packagist](https://packagist.org/packages/csoellinger/php-laravel-fon-ws)[ RSS](/packages/csoellinger-php-laravel-fon-ws/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel FinanzOnline Webservices
================================

[](#laravel-finanzonline-webservices)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d2ede513f38b41e555cc986b61c0611d66c10a7c7f08db2208e5fb0a03a03cbe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63736f656c6c696e6765722f7068702d6c61726176656c2d666f6e2d77732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/csoellinger/php-laravel-fon-ws)[![Total Downloads](https://camo.githubusercontent.com/981964f31eda5286ad3012bb6ffbd9d91d5405ea208c81e8b25153fdd2120944/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63736f656c6c696e6765722f7068702d6c61726176656c2d666f6e2d77732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/csoellinger/php-laravel-fon-ws)

A Laravel package providing seamless integration with the Austrian FinanzOnline (FON) web services. This package wraps the [php-fon-webservices](https://github.com/CSoellinger/php-fon-webservices) library with Laravel-specific features like service container bindings, facades, and artisan commands.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Usage Examples](#usage-examples)
- [Configuration](#configuration)
- [Documentation](#documentation)
- [Development Environment](#development-environment)
- [Testing](#testing)
- [Related Packages](#related-packages)

Features
--------

[](#features)

- 🔐 **Session Management** - Automatic authentication handling
- ✅ **VAT ID Validation** - Check Austrian VAT IDs with two detail levels
- 📥 **Databox Download** - Retrieve tax documents from your digital mailbox
- 📤 **File Upload** - Submit documents to FinanzOnline
- 🏦 **Bank Data Transmission** - Exchange financial data
- 📊 **Query Data Transmission** - Submit information requests
- 🎯 **Dependency Injection** - Full Laravel container integration
- 🎨 **Facades** - Convenient static interface to services
- 🛠️ **Artisan Commands** - CLI tools for common operations
- ✨ **Laravel 12 Ready** - Full support for the latest Laravel version

Requirements
------------

[](#requirements)

- PHP 8.1, 8.2, 8.3, or 8.4
- Laravel 10.x, 11.x, or 12.x
- PHP SOAP extension enabled

**Compatibility Matrix:**

PHP VersionLaravel 10Laravel 11Laravel 128.1✅❌❌8.2✅✅✅8.3✅✅✅8.4✅✅✅> **Note:** If you're using PHP 8.1, you must use Laravel 10. Laravel 11+ requires PHP 8.2+.

> **📦 Multiple PHP Versions:** This package is tested against PHP 8.1-8.4. See [PHP\_VERSIONS.md](PHP_VERSIONS.md) for testing with different versions locally.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require csoellinger/php-laravel-fon-ws
```

### Publish Configuration

[](#publish-configuration)

Publish the configuration file to customize the package:

```
php artisan vendor:publish --provider="CSoellinger\Laravel\FonWebservices\FonWebservicesServiceProvider" --tag="fon-webservices-config"
```

This will create a `config/fon-webservices.php` file in your application.

### Configuration

[](#configuration)

The package reads credentials from the `config/fon-webservices.php` file. By default, it uses environment variables, but you can configure credentials from **any source** (database, cache, config files, etc.).

**Option 1: Using Environment Variables** (recommended for local development)

Add to your `.env` file:

```
FON_TE_ID=your_teilnehmer_id
FON_TE_UID=your_teilnehmer_uid
FON_BEN_ID=your_benutzer_id
FON_BEN_PIN=your_benutzer_pin
```

**Option 2: From Database** (recommended for production)

Edit `config/fon-webservices.php`:

```
'credentials' => [
    'te_id' => DB::table('settings')->value('fon_te_id'),
    'te_uid' => DB::table('settings')->value('fon_te_uid'),
    'ben_id' => DB::table('settings')->value('fon_ben_id'),
    'ben_pin' => decrypt(DB::table('settings')->value('fon_ben_pin')),
],
```

**Option 3: From Cache or Other Sources**

```
'credentials' => [
    'te_id' => Cache::get('fon_credentials')['te_id'],
    // ... or any other source
],
```

> **⚠️ Security Warning:** Never commit credentials to version control! Store sensitive data encrypted in your database or use Laravel's encryption features.

Usage
-----

[](#usage)

### Dependency Injection

[](#dependency-injection)

The recommended way to use the services is through dependency injection:

```
use CSoellinger\FonWebservices\VatIdCheckWs;
use CSoellinger\FonWebservices\Enum\VatIdCheckLevel;

class InvoiceController extends Controller
{
    public function __construct(
        private VatIdCheckWs $vatIdCheck
    ) {}

    public function store(Request $request)
    {
        $result = $this->vatIdCheck->check(
            $request->input('vat_id'),
            VatIdCheckLevel::ExtendedCheck
        );

        if ($result->valid) {
            // VAT ID is valid - process invoice
        }
    }
}
```

### Using Facades

[](#using-facades)

For quick operations, you can use the provided facades:

```
use CSoellinger\Laravel\FonWebservices\Facades\FonVatIdCheck;
use CSoellinger\FonWebservices\Enum\VatIdCheckLevel;

$result = FonVatIdCheck::check('ATU12345678', VatIdCheckLevel::SimpleCheck);

if ($result instanceof \CSoellinger\FonWebservices\Model\VatIdCheckValidLevelOne) {
    echo "Company: {$result->name}";
}
```

### Available Facades

[](#available-facades)

- `FonSession` - Session management
- `FonVatIdCheck` - VAT ID validation
- `FonDataboxDownload` - Databox operations
- `FonFileUpload` - File upload operations
- `FonBankDataTransmission` - Bank data exchange
- `FonQueryDataTransmission` - Query submissions

### Artisan Commands

[](#artisan-commands)

#### Check VAT ID

[](#check-vat-id)

```
# Simple check (level 1)
php artisan fon:check-vat ATU12345678

# Extended check (level 2) with address information
php artisan fon:check-vat ATU12345678 --level=2

# JSON output
php artisan fon:check-vat ATU12345678 --json
```

#### List Databox Items

[](#list-databox-items)

```
# List all items
php artisan fon:list-databox

# Filter by type
php artisan fon:list-databox --type=Veranlagung

# Filter by date range
php artisan fon:list-databox --from=2024-01-01 --to=2024-12-31

# JSON output
php artisan fon:list-databox --json
```

Usage Examples
--------------

[](#usage-examples)

### In Controllers

[](#in-controllers)

```
use CSoellinger\FonWebservices\VatIdCheckWs;
use CSoellinger\FonWebservices\Enum\VatIdCheckLevel;

class VatController extends Controller
{
    public function __construct(
        private VatIdCheckWs $vatIdCheck
    ) {}

    public function check(Request $request)
    {
        $result = $this->vatIdCheck->check(
            $request->input('vat_id'),
            VatIdCheckLevel::ExtendedCheck
        );

        if ($result instanceof \CSoellinger\FonWebservices\Model\VatIdCheckValidLevelTwo) {
            return response()->json([
                'valid' => true,
                'name' => $result->name,
                'address' => [
                    'street' => $result->street,
                    'zip' => $result->zip,
                    'city' => $result->city,
                ],
            ]);
        }

        return response()->json(['valid' => false]);
    }
}
```

### In Jobs

[](#in-jobs)

```
use CSoellinger\FonWebservices\DataboxDownloadWs;
use CSoellinger\FonWebservices\Enum\DataboxType;

class ProcessDataboxItems implements ShouldQueue
{
    use Queueable, SerializesModels, InteractsWithQueue;

    public function handle(DataboxDownloadWs $databox): void
    {
        $from = new \DateTime('-7 days');
        $to = new \DateTime();

        $items = $databox->get(
            type: DataboxType::All,
            from: $from,
            to: $to
        );

        foreach ($items as $item) {
            // Process each databox item
            $content = $databox->getEntry($item->applkey);
            // Store or process the document...
        }
    }
}
```

### In API Routes

[](#in-api-routes)

```
use Illuminate\Support\Facades\Route;
use CSoellinger\Laravel\FonWebservices\Facades\FonVatIdCheck;

Route::get('/api/vat/check/{vatId}', function (string $vatId) {
    $result = FonVatIdCheck::check($vatId);

    return response()->json([
        'vat_id' => $vatId,
        'valid' => $result->valid,
    ]);
});
```

### In Livewire Components

[](#in-livewire-components)

```
use Livewire\Component;
use CSoellinger\FonWebservices\VatIdCheckWs;

class VatChecker extends Component
{
    public string $vatId = '';
    public ?bool $isValid = null;

    public function checkVat(VatIdCheckWs $vatIdCheck)
    {
        $result = $vatIdCheck->check($this->vatId);
        $this->isValid = $result->valid;
    }

    public function render()
    {
        return view('livewire.vat-checker');
    }
}
```

### Session Management

[](#session-management)

Session management is handled automatically - services will auto-login when needed. For manual session control:

```
use CSoellinger\FonWebservices\SessionWs;

class CustomService
{
    public function __construct(
        private SessionWs $session
    ) {}

    public function performOperations(): void
    {
        // Manually login
        $loginResponse = $this->session->login();

        // Perform operations...

        // Manually logout
        $this->session->logout();
    }
}
```

Configuration
-------------

[](#configuration-1)

The `config/fon-webservices.php` file allows you to customize:

- **Credentials** - FinanzOnline authentication details
- **SOAP Options** - Configure SOAP client behavior
- **Service Bindings** - Enable/disable specific services

### SOAP Options

[](#soap-options)

These options are passed directly to PHP's [SoapClient constructor](https://www.php.net/manual/en/soapclient.construct.php) and control the underlying SOAP behavior:

```
'soap_options' => [
    'trace' => env('FON_SOAP_TRACE', false),           // Enable request/response tracing (debugging)
    'exceptions' => env('FON_SOAP_EXCEPTIONS', true),  // Throw exceptions on SOAP errors
    'connection_timeout' => env('FON_SOAP_TIMEOUT', 30), // Connection timeout in seconds
    'cache_wsdl' => env('FON_SOAP_CACHE_WSDL', WSDL_CACHE_DISK), // WSDL caching mode
],
```

You can add any [valid SoapClient option](https://www.php.net/manual/en/soapclient.construct.php) here. Common options include `compression`, `user_agent`, `proxy_host`, etc.

### Disable Unused Services

[](#disable-unused-services)

To reduce memory usage, you can disable services you don't use:

```
'services' => [
    'session' => true,
    'vat_id_check' => true,
    'databox_download' => false,  // Disabled
    'file_upload' => false,       // Disabled
    'bank_data_transmission' => false,
    'query_data_transmission' => false,
],
```

Documentation
-------------

[](#documentation)

For the base class API documentation go to

Also check out repo from the base class:

Development Environment
-----------------------

[](#development-environment)

This package uses [Laravel Sail](https://laravel.com/docs/sail) for local development with Docker or Podman.

### Quick Start

[](#quick-start)

```
# Clone and setup
git clone https://github.com/csoellinger/php-laravel-fon-ws.git
cd php-laravel-fon-ws
cp .env.example .env

# Add your FON credentials to .env (for local testing)
# Or configure them in config/fon-webservices.php from any source

# Install dependencies and start
composer install
./vendor/bin/sail up -d

# Run tests
./vendor/bin/sail composer test
```

### Testing with Different PHP Versions

[](#testing-with-different-php-versions)

```
# Test against PHP 8.1, 8.2, 8.3, or 8.4
PHP_VERSION=8.1 ./vendor/bin/sail up -d
```

Testing
-------

[](#testing)

```
# Run tests
composer test

# Run tests with coverage
composer test-coverage

# Run static analysis
composer analyse

# Format code
composer format
```

Related Packages
----------------

[](#related-packages)

- [csoellinger/php-fon-webservices](https://github.com/CSoellinger/php-fon-webservices) - Core PHP library (framework-agnostic)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance50

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17972547?v=4)[CSoellinger](/maintainers/CSoellinger)[@CSoellinger](https://github.com/CSoellinger)

---

Top Contributors

[![Zerogiven](https://avatars.githubusercontent.com/u/389319?v=4)](https://github.com/Zerogiven "Zerogiven (6 commits)")

### Embed Badge

![Health badge](/badges/csoellinger-php-laravel-fon-ws/health.svg)

```
[![Health](https://phpackages.com/badges/csoellinger-php-laravel-fon-ws/health.svg)](https://phpackages.com/packages/csoellinger-php-laravel-fon-ws)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
