New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

innobrain/laravel-onoffice-adapter

Laravel package to joyfully interact with the onOffice API
52,410 5

Larablocks Analysis

innobrain/laravel-onoffice-adapter works with Laravel 11, 12 and 13 (latest release v2.11.0, Nov 27, 2026).

Laravel 10 in earlier releases.

Recommendation checks

Solid choice

Solid choice: maintained and up to date, meets 2 of 4 checks; below the bar for Recommended on use.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Nov 27, 2026)
  • 5,615 downloads a month (needs 10,000)
  • 5 GitHub stars (needs 100)

State

Actively maintained
  • Last stable release: Nov 27, 2026.
  • 33 releases in the last 12 months.
  • First released: May 12, 2024.
  • Monthly downloads: 5,615.
  • 5 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.

Install
composer require innobrain/laravel-onoffice-adapter
Latest Version:v2.11.0
PHP:^8.2
Laravel:11 · 12 · 13
Older releases:10
License:MIT
Last Updated:Nov 27, 2026
Links: GitHub  ·  Packagist
Maintainer: innobrain

onOffice Adapter for Laravel

Latest Version on Packagist Laravel Compatibility GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A query builder for the onOffice API with an Eloquent-style interface.

View Full Documentation

Features

  • Query builder - select(), where(), orderBy(), limit(), offset()
  • Repositories - Estates, addresses, activities, appointments, tasks, search criteria, files, relations, and more
  • Pagination - get() reads every page; each() processes one page at a time
  • Middlewares - Run code before and after each request
  • Testing - Fake responses and record factories
  • Files - Upload, chunk, and link files to records
  • Read-only mode - Refuse every write, globally, per credentials, or per query

Installation

composer require innobrain/laravel-onoffice-adapter

Add your onOffice API credentials to .env:

ON_OFFICE_TOKEN=your-token
ON_OFFICE_SECRET=your-secret

Requests go to https://api.onoffice.de/api/stable/api.php. Set ON_OFFICE_BASE_URL to use another API version or a proxy.

To change retry settings or headers, publish the config file:

php artisan vendor:publish --tag="onoffice-adapter-config"

The package keeps one HTTP connection to the onOffice API open per PHP process and reuses it for every request, which skips the TCP and TLS handshake on all but the first call. Long-lived processes such as queue workers and Octane benefit most. If a stale connection is closed by the server, the request fails with a connection error and the retry settings above take over. Set reuse_connection to false in the config to open a fresh connection per request instead.

Usage

Basic Queries

use Innobrain\OnOfficeAdapter\Facades\EstateRepository;

// Get all estates
$estates = EstateRepository::query()->get();

// Find by ID
$estate = EstateRepository::query()->find(123);

// Get first result
$estate = EstateRepository::query()->first();

// Count results
$count = EstateRepository::query()->count();

Building Queries

Chain methods to filter, sort, and limit results:

$estates = EstateRepository::query()
    ->select(['Id', 'kaufpreis', 'lage'])
    ->where('status', 1)
    ->where('kaufpreis', '<', 500000)
    ->orderByDesc('kaufpreis')
    ->limit(10)
    ->get();

Available Methods

Method Description
select($fields) Fields to retrieve
where($field, $op, $value) Filter by condition
whereIn($field, $values) Filter by array of values
whereLike($field, $pattern) Pattern matching
whereBetween($field, $min, $max) Range filter
orderBy($field) Sort ascending
orderByDesc($field) Sort descending
limit($n) Max results
offset($n) Skip results

Large Datasets

each() processes one page per callback:

EstateRepository::query()
    ->each(function (array $estates) {
        foreach ($estates as $estate) {
            // Process chunk
        }
    });

A failed page throws OnOfficeException. No partial results. Chunks already passed to the callback are not rolled back.

Available Repositories

Repository Description
EstateRepository Real estate properties
AddressRepository Contacts and addresses
ActivityRepository Activity logs
ActionRepository Action kind types
AppointmentRepository Calendar appointments
TaskRepository Tasks
UserRepository onOffice users
SearchCriteriaRepository Buyer search profiles
FieldRepository Field metadata
FileRepository File uploads and downloads
FilterRepository Saved filters
RelationRepository Record relationships
SettingRepository System settings
MarketplaceRepository Marketplace integration
LinkRepository URL links
LogRepository Log entries
MacroRepository Macros
LastSeenRepository Recently viewed records

File Uploads

$tmpUploadId = FileRepository::upload()
    ->save(base64_encode($fileContent));

FileRepository::upload()->link($tmpUploadId, [
    'module' => 'estate',
    'relatedRecordId' => '12345',
]);

// Or upload in blocks and link in one call
FileRepository::upload()
    ->uploadInBlocks()
    ->saveAndLink(base64_encode($fileContent), [
        'module' => 'estate',
        'relatedRecordId' => '12345',
    ]);

save() checks the size onOffice reports after the last block. If a block arrived twice or not at all, it starts over once from a new temporary file, then throws IncompleteUploadException instead of linking a corrupt file.

Creating Activities

ActivityRepository::query()
    ->addressIds($recordIds)
    ->estateId($estateId)
    ->create([
        'datetime' => $event->getDateFormatted(),
        'actionkind' => 'Newsletter',
        'actiontype' => 'Hard Bounce',
        'note' => $message,
    ]);

Middlewares

Run code before each request:

use Innobrain\OnOfficeAdapter\Facades\BaseRepository;
use Innobrain\OnOfficeAdapter\Dtos\OnOfficeRequest;

BaseRepository::query()
    ->before(function (OnOfficeRequest $request) {
        Log::info('Sending request', ['request' => $request->toArray()]);
    })
    ->call(new OnOfficeRequest(/* ... */));

Read-Only Mode

Refuses every mutating action (create, modify, delete and do) before it is sent and throws a ReadOnlyViolationException. Reads are unaffected.

// Globally
ON_OFFICE_READ_ONLY=true

// Per credentials
EstateRepository::query()->withCredentials($token, $secret, readOnly: true)->get();

// Per query
EstateRepository::query()->readOnly()->get();

Any layer can turn it on, none can turn it off.

Debugging

// Dump and die
BaseRepository::query()->dd()->call(/* ... */);

// Dump without stopping
BaseRepository::query()->dump()->call(/* ... */);

// Record requests and responses
BaseRepository::record();
BaseRepository::query()->call(/* ... */);
$lastPair = BaseRepository::lastRecorded(); // [OnOfficeRequest, array]

Helpers

Default field lists and empty-value cleanup:

use Innobrain\OnOfficeAdapter\Services\OnOfficeService;

$estates = EstateRepository::query()
    ->select(OnOfficeService::DEFAULT_ESTATE_INFO_FIELDS)
    ->get();

// Remove fields with empty values ("", "0.00", [], null)
$estates = $estates->map(fn (array $estate) => clear_elements($estate));

Testing

Fake responses in tests:

use Innobrain\OnOfficeAdapter\Facades\EstateRepository;
use Innobrain\OnOfficeAdapter\Facades\Testing\RecordFactories\EstateFactory;

EstateRepository::fake(EstateRepository::response([
    EstateRepository::page(recordFactories: [
        EstateFactory::make()->id(1)->set('kaufpreis', 250000),
        EstateFactory::make()->id(2)->set('kaufpreis', 300000),
    ]),
]));

$estates = EstateRepository::query()->get();

expect($estates)->toHaveCount(2);
EstateRepository::assertSentCount(1);

Prevent Unstubbed Requests

EstateRepository::preventStrayRequests();
EstateRepository::fake(/* ... */);

// Any unstubbed request will throw StrayRequestException

Multiple Pages

EstateRepository::fake(EstateRepository::response([
    EstateRepository::page(recordFactories: [
        EstateFactory::make()->id(1),
    ]),
    EstateRepository::page(recordFactories: [
        EstateFactory::make()->id(2),
    ]),
]));

$estates = EstateRepository::query()->get();
expect($estates)->toHaveCount(2);

Sequences (Multiple Calls)

EstateRepository::fake([
    EstateRepository::response([/* first call */]),
    EstateRepository::response([/* second call */]),
]);

// Or repeat the same response
EstateRepository::fake(EstateRepository::sequence(
    EstateRepository::response([/* ... */]),
    times: 30,
));

See Testing for factories and assertions.

Development

composer test       # Run tests
composer analyse    # Static analysis (PHPStan)
composer format     # Code formatting (Laravel Pint)

Changelog

See CHANGELOG. For breaking changes, see UPGRADE.

Security Vulnerabilities

See the security policy.

Credits

License

MIT. See LICENSE.

Related Packages

innobrain/markitdown

Laravel bindings for markitdown.

16,347 7
innobraingmbh/onoffice-structure

Package to extract the enterprise configuration

14,598 1
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440

Version History

Version Released PHP Laravel License
v2.11.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v2.10.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v2.9.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v2.8.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v2.7.1 ^8.2 ^11.0|^12.0|^13.0 MIT