codeOverview

The mini-eric-php SDK provides an object-oriented PHP wrapper around the CLI binaries for easy integration into PHP applications.

What is mini-eric-php?

mini-eric-php is a PHP SDK that wraps the ceric and cotto binaries, providing:

  • Object-oriented interface for processing ELSTER XML documents

  • Structured result objects with parsed error and hint information

  • Automatic binary management with built-in validation

  • Error handling with detailed error messages

  • Easy integration into existing PHP applications

Key Features

  • PHP 8.3+ support with modern syntax

  • Type-safe with strict typing and comprehensive type hints

  • Comprehensive testing with 100% test coverage

  • PSR-4 autoloading for easy Composer integration

  • Symfony Process integration for reliable process execution

  • Error handling with parsed XML results

Installation

Install via Composer:

Quick start

Basic Usage

Error Handling

Core Classes

Ceric

The main class for interacting with the ERiC binary.

Methods:

  • draft(CericInput $input, ?string $cwd = null): Result - Validate and generate PDF preview

  • send(CericInput $input, ?string $cwd = null): Result - Validate, transmit, and generate PDF confirmation

  • transmit(CericInput $input, ?string $cwd = null): Result - Validate and transmit (no PDF)

  • download(CottoInput $input, ?string $cwd = null): Result - Download data by UUID

  • help(?string $cwd = null): Result - Get binary help

  • version(?string $cwd = null): Result - Get binary version

Input DTOs

CericInput

Input DTO for ERiC operations.

CottoInput

Input DTO for download operations.

Result Objects

Result

The main result object containing all operation data.

CericOutput

Contains the JSON response from the ceric binary:

EricProcessResult

Parsed XML result with structured error and hint information:

Usecases

1. Draft Validation

Validate XML document and generate PDF previews without transmission:

2. Document Sending

Send document to ELSTER servers and create PDF:

3. Document Transmission

Transmit document to ELSTER servers without creating a PDF:

4. Data Download

Download data from OTTER server:

Configuration

Custom Binary Path

Disable Binary Validation

Custom Process Runner

Next Steps

Last updated