PHPackages                             innobraingmbh/onoffice-structure - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. innobraingmbh/onoffice-structure

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

innobraingmbh/onoffice-structure
================================

Package to extract the enterprise configuration

v1.3.0(3mo ago)05.8k↓41.9%[1 PRs](https://github.com/innobraingmbh/onoffice-structure/pulls)MITPHPPHP ^8.4CI passing

Since May 24Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/innobraingmbh/onoffice-structure)[ Packagist](https://packagist.org/packages/innobraingmbh/onoffice-structure)[ Docs](https://github.com/innobraingmbh/onoffice-structure)[ GitHub Sponsors](https://github.com/Innobrain)[ RSS](/packages/innobraingmbh-onoffice-structure/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (15)Used By (0)

onOffice Structure Extractor for Laravel
========================================

[](#onoffice-structure-extractor-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/85aedf0c6b1b68ae6e80256f21c59160734e1ec024870f8a805e1efd8d79d74d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e6e6f627261696e676d62682f6f6e6f66666963652d7374727563747572652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/innobraingmbh/onoffice-structure)[![GitHub Tests Action Status](https://camo.githubusercontent.com/781ccf2da4c9ad96c30146a41ab081fcd5da08245fe23b0941ef549ba9b84d25/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696e6e6f627261696e676d62682f6f6e6f66666963652d7374727563747572652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/innobraingmbh/onoffice-structure/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/72be3e53bedc937cc750064e8efa40f95e6ecf49b84c69ffbbd873d7fc1baf4d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696e6e6f627261696e676d62682f6f6e6f66666963652d7374727563747572652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/innobraingmbh/onoffice-structure/actions?query=workflow%3A%22Fix+PHP+Code+Style+Issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1e0abc8f59f45154bfbac94710254f77b90d441b1ef946522f20492f3225f553/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e6e6f627261696e676d62682f6f6e6f66666963652d7374727563747572652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/innobraingmbh/onoffice-structure)

Extract and work with the onOffice enterprise field configuration (Modul- und Feldkonfiguration) in Laravel. The package fetches configurations via [innobrain/laravel-onoffice-adapter](https://github.com/innobraingmbh/laravel-onoffice-adapter), transforms them into readonly DTOs, and converts them into various output formats using a strategy pattern.

Features
--------

[](#features)

- Fetch field configurations for all onOffice modules (Address, Estate, AgentsLog, Calendar, Email, File, News, Intranet, Project, Task, User)
- Readonly DTOs for Modules, Fields, Permitted Values, Dependencies, and Filters
- Convert to arrays, Laravel validation rules, [Prism PHP](https://prismphp.com/) schemas, or JSON Schema
- Filter fields by configuration-based conditions with a fluent builder
- Sanitize input data against field definitions and permitted values
- Multi-language support (German, English, French, Spanish, Italian, Croatian)
- Extensible converter strategy pattern for custom output formats

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

[](#installation)

```
composer require innobraingmbh/onoffice-structure
```

You can optionally publish the configuration file:

```
php artisan vendor:publish --provider="Innobrain\Structure\StructureServiceProvider" --tag="onoffice-structure-config"
```

Usage
-----

[](#usage)

### Fetching Structure Data

[](#fetching-structure-data)

Use the `Structure` facade or inject `Innobrain\Structure\Services\Structure`:

```
use Innobrain\OnOfficeAdapter\Dtos\OnOfficeApiCredentials;
use Innobrain\Structure\Enums\FieldConfigurationModule;
use Innobrain\Structure\Enums\Language;
use Innobrain\Structure\Facades\Structure;

$credentials = new OnOfficeApiCredentials('your-token', 'your-secret');

// Fetch all modules (defaults to German labels)
$modules = Structure::forClient($credentials)->getModules();

// Fetch specific modules in a specific language
$modules = Structure::forClient($credentials)->getModules(
    only: [FieldConfigurationModule::Address->value, FieldConfigurationModule::Estate->value],
    language: Language::English,
);

// Iterate over modules and fields
foreach ($modules as $moduleKey => $module) {
    echo "Module: {$module->label} ({$module->key->value})\n";
    foreach ($module->fields as $fieldKey => $field) {
        echo "  Field: {$field->label} ({$field->key}) - Type: {$field->type->value}\n";
    }
}
```

### Filtering Fields

[](#filtering-fields)

Fields can have filter configurations that determine their visibility based on other field values. Use the fluent `FieldFilterBuilder` to narrow down fields:

```
$addressModule = $modules->get(FieldConfigurationModule::Address->value);

$filteredFields = $addressModule->fields
    ->whereMatchesFilters()
    ->where('Art', '2')       // only fields visible when Art = 2
    ->when($someCondition, fn ($builder) => $builder->where('ArtDaten', '1'))
    ->get();
```

### Sanitizing Input Data

[](#sanitizing-input-data)

Remove keys that don't match known fields or have invalid permitted values:

```
$sanitized = $addressModule->fields->sanitize(collect([
    'Email' => 'test@example.com',
    'unknownField' => 'value',      // removed: not in field collection
    'Beziehung' => '999',           // removed: not a permitted value
]));
```

### Converting Data

[](#converting-data)

All DTOs and collections implement `Convertible` and can be transformed using a `ConvertStrategy`.

#### Array Conversion

[](#array-conversion)

```
use Innobrain\Structure\Converters\Array\ArrayConvertStrategy;

$strategy = new ArrayConvertStrategy(dropEmpty: true); // remove null/empty values

$allModulesArray = $modules->convert($strategy);
$moduleArray = $addressModule->convert($strategy);
$fieldArray = $addressModule->fields->get('Email')->convert($strategy);
```

#### Laravel Validation Rules

[](#laravel-validation-rules)

```
use Innobrain\Structure\Converters\LaravelRules\LaravelRulesConvertStrategy;

// Pipe-separated strings with nullable (default)
$strategy = new LaravelRulesConvertStrategy(pipeSyntax: true, includeNullable: true);
$rules = $addressModule->convert($strategy);
// ['KdNr' => 'integer|nullable', 'Email' => 'string|max:100|nullable', ...]

// Array syntax without nullable
$strategy = new LaravelRulesConvertStrategy(pipeSyntax: false, includeNullable: false);
$rules = $addressModule->convert($strategy);
// ['KdNr' => ['integer'], 'Email' => ['string', 'max:100'], ...]

// Multi-select fields automatically get a wildcard rule:
// 'Beziehung' => 'array|distinct|nullable', 'Beziehung.*' => 'in:0,1,2,3'
```

#### Prism Schema (for AI tooling)

[](#prism-schema-for-ai-tooling)

```
use Innobrain\Structure\Converters\PrismSchema\PrismSchemaConvertStrategy;

$strategy = new PrismSchemaConvertStrategy(
    includeNullable: true,      // mark fields without defaults as nullable
    includeDescriptions: true,  // use field labels as descriptions
);

$schema = $addressModule->convert($strategy);
// Returns an ObjectSchema usable with Prism's structured output
```

Field type mapping: `VarChar/Text/Blob` -&gt; `StringSchema`, `Integer/Float` -&gt; `NumberSchema`, `Boolean` -&gt; `BooleanSchema`, `Date/DateTime` -&gt; `StringSchema` (with format hint), `SingleSelect` -&gt; `EnumSchema`, `MultiSelect` -&gt; `ArraySchema`.

#### JSON Schema

[](#json-schema)

```
use Innobrain\Structure\Converters\JsonSchema\JsonSchemaConvertStrategy;

$strategy = new JsonSchemaConvertStrategy(
    includeNullable: true,
    includeDescriptions: true,
);

$schema = $addressModule->convert($strategy);
// Returns a JsonSchema ObjectType
```

### Writing a Custom Converter

[](#writing-a-custom-converter)

Implement `ConvertStrategy` (or extend `BaseConvertStrategy`) and add `convertField`, `convertModule`, etc. methods matching the DTO class names:

```
use Innobrain\Structure\Converters\Concerns\BaseConvertStrategy;
use Innobrain\Structure\Dtos\Field;
use Innobrain\Structure\Dtos\Module;

final readonly class MyConvertStrategy extends BaseConvertStrategy
{
    public function convertModule(Module $module): mixed { /* ... */ }
    public function convertField(Field $field): mixed { /* ... */ }
}

$result = $module->convert(new MyConvertStrategy());
```

DTOs
----

[](#dtos)

All DTOs are readonly and implement `Convertible`.

DTOKey Properties`Module``key` (FieldConfigurationModule), `label`, `fields` (FieldCollection)`Field``key`, `label`, `type` (FieldType), `length`, `permittedValues`, `default`, `filters`, `dependencies`, `compoundFields`, `fieldMeasureFormat``PermittedValue``key`, `label``FieldDependency``dependentFieldKey`, `dependentFieldValue``FieldFilter``name`, `config`Testing
-------

[](#testing)

```
composer test              # Run tests
composer test-coverage     # Run tests with coverage
composer analyse           # PHPStan static analysis
composer format            # Rector + Pint formatting
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Contributions are welcome! Please open an issue or pull request. For bug reports, use the [Bug Report Template](.github/ISSUE_TEMPLATE/bug.yml).

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability, please send an e-mail to Konstantin Auffinger via the email address in `composer.json`. All security vulnerabilities will be promptly addressed.

Credits
-------

[](#credits)

- [Konstantin Auffinger](https://github.com/kauffinger)
- [All Contributors](../../contributors)

Built with [Spatie's Laravel Package Tools](https://github.com/spatie/laravel-package-tools).

License
-------

[](#license)

The MIT License (MIT). Please see [composer.json](composer.json) for more information.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance84

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 65.7% 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.

###  Release Activity

Cadence

Every ~26 days

Total

11

Last Release

101d ago

Major Versions

v0.2.0 → v1.0.02025-10-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/beb1d357716423ec46cf7e3ff0827574b0e17a095bc2cd7b218bf5955056be9b?d=identicon)[innobrain](/maintainers/innobrain)

---

Top Contributors

[![kauffinger](https://avatars.githubusercontent.com/u/62616071?v=4)](https://github.com/kauffinger "kauffinger (65 commits)")[![Katalam](https://avatars.githubusercontent.com/u/39590058?v=4)](https://github.com/Katalam "Katalam (26 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

laravelInnobrainonoffice-structure

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/innobraingmbh-onoffice-structure/health.svg)

```
[![Health](https://phpackages.com/badges/innobraingmbh-onoffice-structure/health.svg)](https://phpackages.com/packages/innobraingmbh-onoffice-structure)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.8k28.9M627](/packages/spatie-laravel-data)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[spatie/laravel-url-ai-transformer

Transform URLs and their content using AI

265.3k](/packages/spatie-laravel-url-ai-transformer)

PHPackages © 2026

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