Download the PHP package codebar-ag/laravel-docuware without Composer
On this page you can find all versions of the php package codebar-ag/laravel-docuware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codebar-ag/laravel-docuware
More information about codebar-ag/laravel-docuware
Files in codebar-ag/laravel-docuware
Package laravel-docuware
Short Description DocuWare integration with Laravel
License MIT
Homepage https://github.com/codebar-ag/laravel-docuware
Informations about the package laravel-docuware
An opinionated, modern integration for the DocuWare Platform REST API. You work with resources and immutable data objects β never raw HTTP.
This package is not designed as a replacement for the official DocuWare REST API. It is an opinionated convenience layer on top of it.
Table of contents
- Highlights
- Requirements
- Installation
- Configuration
- Authentication & grants
- Connecting (config file or runtime DTO)
- Quickstart
- Resources
- Search builder
- Index field values
- Immutable data & withers
- Enums
- Encrypted document URLs
- Endpoint catalog
- Data object (DTO) reference
- Caching
- Error handling
- Events
- Security
- Testing
- Credits
- License
Highlights
- π― Small, domain-shaped API β
DocuWare::documents($cabinet)->search()->cursor(). - π§ Immutable data via
spatie/laravel-datawith->copyWith(...)withers. - π’ Multi-tenant first-class β by config name or a runtime connection DTO.
- π’ Typed index fields β
IndexFields::make()->text(...)->number(...)->date(...)->table(...)converts PHP values into the exact DocuWare wire format for you. - π Secure by default β secrets are never logged, evented, or thrown.
- β»οΈ Resilient β encrypted + lock-guarded token store, retry with backoff honoring
Retry-After. - π§― One error model β every failure descends from
DocuWareException. - π§ͺ Fully fakeable & typed β PHPStan max, offline fixture replay.
Requirements
| Version | PHP | Laravel | DocuWare Cloud |
|---|---|---|---|
| v14 | ^8.4 β ^8.5 | 13.* | β |
| v13 | ^8.3 β ^8.4 | 13.* | β |
| v12 | ^8.2 β ^8.4 | 12.* | β |
| v11 (alpha) | ^8.2 | 11.* | β |
| > v4.0 | ^8.2 | 11.* | β |
| > v3.0 | ^8.2 | 10.* | β |
| > v2.0 | ^8.1 | 9.* | β |
| > v1.2 | ^8.1 | 9.* | β |
| < v1.2 | ^8.0 | 8.* | β |
v14 raises the minimum PHP to 8.4. Laravel 13 stays the target framework.
Installation
Configure the default instance in .env:
Configuration
The default instance reads the flat DOCUWARE_* env keys above. Everything else has sane defaults;
publish the config to tune caching, retries, rate limiting, and multi-tenant instances.
Full config reference (config/laravel-docuware.php)
| Key | Env | Default | Purpose |
| --- | --- | --- | --- |
| `default` | `DOCUWARE_INSTANCE` | `default` | Which instance bare facade calls use |
| `platform_path` | `DOCUWARE_PLATFORM_PATH` | `DocuWare/Platform` | REST base path appended to the URL |
| `timeout` | `DOCUWARE_TIMEOUT` | `15` | Default request timeout (seconds) |
| `passphrase` | `DOCUWARE_PASSPHRASE` | β | Passphrase for encrypted document URLs |
| `instances.*` | β | β | Named multi-tenant connections (see below) |
| `credentials.url` | `DOCUWARE_URL` | β | Legacy flat URL for the `default` instance |
| `credentials.username` | `DOCUWARE_USERNAME` | β | Legacy flat username |
| `credentials.password` | `DOCUWARE_PASSWORD` | β | Legacy flat password |
| `configurations.client_id` | `DOCUWARE_CLIENT_ID` | `docuware.platform.net.client` | OAuth client id |
| `configurations.scope` | `DOCUWARE_SCOPE` | `docuware.platform` | OAuth scope |
| `configurations.cache.driver` | `DOCUWARE_CACHE_DRIVER` | `file` | Cache store for responses & tokens |
| `configurations.cache.lifetime_in_seconds` | `DOCUWARE_CACHE_LIFETIME_IN_SECONDS` | `60` | Cache TTL for `Cacheable` requests |
| `configurations.request.timeout_in_seconds` | `DOCUWARE_TIMEOUT` | `60` | Per-request timeout |
| `debug.capture_bodies` | `DOCUWARE_DEBUG_CAPTURE_BODIES` | `false` | Attach (redacted) bodies to `ResponseReceived` |
| `retry.enabled` | `DOCUWARE_RETRY_ENABLED` | `true` | Exponential backoff on transient failures |
| `retry.times` | `DOCUWARE_RETRY_TIMES` | `3` | Max retry attempts |
| `retry.base_interval_ms` | `DOCUWARE_RETRY_BASE_INTERVAL_MS` | `250` | First backoff interval |
| `retry.max_interval_ms` | `DOCUWARE_RETRY_MAX_INTERVAL_MS` | `10000` | Backoff ceiling |
| `rate_limit.enabled` | `DOCUWARE_RATE_LIMIT_ENABLED` | `false` | Per-instance client-side rate limiting |
| `rate_limit.allow` | `DOCUWARE_RATE_LIMIT_ALLOW` | `60` | Requests allowed per window |
| `rate_limit.per_seconds` | `DOCUWARE_RATE_LIMIT_PER_SECONDS` | `60` | Window length (seconds) |
Authentication & grants
OAuth is handled for you: the package discovers the identity service, exchanges credentials for an access token, encrypts it, caches it per instance, and refreshes it under a lock before it expires. You never call the token endpoint yourself.
Three grants are supported:
| Grant | grant value |
Needs | Use case |
|---|---|---|---|
| Credentials | credentials |
url, username, password | Standard username/password login |
| Trusted user | trusted_user |
url, username, password, impersonate | Authenticate as a trusted user, act as another |
| DocuWare token | token |
url, token | Exchange a DocuWare login token (dwtoken) |
Connecting (config file or runtime DTO)
There are two ways to connect β pick whichever fits your tenancy model.
1. Named instances in config
Best when tenants are known ahead of time. Add them to config/laravel-docuware.php:
2. A runtime connection DTO (database-driven multi-tenancy)
Multi-tenancy is not limited to config files. When connections live in your database β the common
case β build a typed config DTO at runtime and hand it to DocuWare::connection():
Each grant has a typed for() factory that fills sensible defaults (cache driver, lifetime, timeout,
client id, scope) β override any of them as named arguments:
DocuWare::instance(...) also accepts a DTO directly, so DocuWare::instance($config) and
DocuWare::connection($config) are equivalent. Runtime connections are not name-cached, so two
tenants may safely reuse a name; their tokens stay isolated by URL + credentials.
Every connection is independent: its own connector, cache namespace, encrypted token entry, and rate limiter.
Quickstart
Resources
Every resource is reached from the DocuWare facade (default instance) or from a resolved client
(DocuWare::instance('acme')->β¦, DocuWare::connection($config)->β¦). Each returns immutable *Data
objects or collections of them.
Documents β DocuWare::documents($cabinetId)
The documents resource is broad, so its methods are grouped by area below.
Core (search, read, write, lifecycle)
| Method | Returns | Description |
|---|---|---|
search() |
SearchQuery |
Fluent search builder (see below) |
find($id) |
DocumentData |
A single document |
count() |
int |
Total documents in the cabinet |
store($fileContent, $fileName, $indexes, $storeDialogId) |
DocumentData |
Create a data record |
update($id, $indexes, $forceUpdate = false) |
Collection<DocumentFieldData> |
Update index values |
delete($id) |
β | Delete a document |
download($id, TargetFileType = AUTO, $keepAnnotations = false) |
string |
Binary content |
preview($id) |
string |
Preview image bytes |
Sections (a document is composed of one or more file sections)
| Method | Returns | Description |
|---|---|---|
sections($id) / section($sectionId) |
Collection<SectionData> / SectionData |
List / fetch sections |
deleteSection($sectionId) |
bool |
Delete a section |
downloadSection($sectionId) / textshot($sectionId) |
string |
Section data / text layer |
thumbnail($sectionId, $page = 0) |
string |
Thumbnail bytes |
Annotations & application properties
| Method | Returns | Description |
|---|---|---|
annotations($id) / annotate($id, $payload) / stamps($id) |
Collection / mixed / Collection |
Annotations & stamps |
applicationProperties($id) / addApplicationProperties(...) / updateApplicationProperties(...) / deleteApplicationProperties(...) |
mixed |
App-defined properties |
Structure operations (clip/staple, transfer, batch & upload)
| Method | Returns | Description |
|---|---|---|
clip($ids, $force) / staple($ids, $force) / unclip($id) / unstaple($id) |
DocumentData / DocumentPageData |
Content merge/divide |
transfer($id, $destinationFileCabinetId, $storeDialogId, $keepSource = false) |
bool |
Move/copy across cabinets |
batchUpdate(...) / appendPdf(...) / appendFiles(...) / replaceSection(...) |
array / Section / Document |
Batch & upload operations |
workflowHistory($id) |
Collection<HistoryStepData> |
Document workflow history |
File cabinets & structure β fileCabinets, dialogs, selectLists
Cabinet metadata, the search/store dialogs defined on a cabinet, and the option lists behind select fields.
Organization & users β organizations, users, groups, roles
Tenant-level directory: the organization, its users, and the groups/roles they belong to.
Workflows β workflows
Trash (recycle bin) β trash
Documents deleted from a cabinet land here until purged or restored.
Search builder
DocuWare::documents($cabinetId)->search() returns a fluent SearchQuery. Conditions and ordering
are chainable; a terminal method runs the request.
| Terminal | Returns | Description |
|---|---|---|
get() |
DocumentPageData |
One page of results |
first() |
?DocumentData |
First match, or null |
count() |
int |
Total matching documents |
cursor() |
LazyCollection<DocumentData> |
Memory-safe iteration over all pages |
Index field values
DocuWare expects each index value in a specific wire shape (FieldName / Item / ItemElementName).
You don't build that by hand β pass PHP values to the IndexFields builder and it converts each one to
the correct typed field. This is the answer to "how do I pass an int / string / table and get the right
index field?"
| Builder method | Argument type | DocuWare ItemElementName |
|---|---|---|
text($name, $value) |
?string |
String |
memo($name, $value) |
?string |
Memo |
keyword($name, $value) |
?string |
Keyword |
number($name, $value) |
?int |
Int |
decimal($name, $value) |
int\|float\|null |
Decimal |
date($name, $value) |
?Carbon |
String (date) |
dateTime($name, $value) |
?Carbon |
String (datetime) |
table($name, $rows) |
array\|Collection |
Table |
IndexFields::make() starts a builder; isEmpty() tells you whether anything was added; and
toCollection() returns the underlying index objects. store() and update() also accept that
raw Collection directly if you need to build the DTOs yourself, but IndexFields is the
recommended path.
Updating index fields
update() writes index values on an existing document β every field type uses the same call,
including tables. It returns a Collection<string, DocumentFieldData> keyed by field name (the
server's view of the fields after the write):
Pass forceUpdate: false (the default) to let DocuWare reject writes to protected fields; pass
true to force them through where the cabinet permits.
Table fields
A table field holds rows of typed cells. The same table($name, $rows) builder is used for
both create (store()) and update (update()), and accepts rows in either form:
-
Simple β an associative
[column => value]map per row; cell types are auto-detected (string β String,int β Int,float β Decimal,Carbon β DateTime): - Explicit β build each cell with an index DTO when you need exact typing that auto-detection can't infer (a date-only cell, a keyword, or a memo):
Tables are written wholesale. A
store()/update()call replaces every row of the field, so always pass the complete set of rows you want stored. To append, read the current rows first (see below) and re-send them along with the new ones.
Reading a table back, the field's ->value is a Collection<TableRowData>; each row exposes its
cells as a Collection<string, DocumentFieldData> keyed by column name (cell values already parsed
to native PHP types):
Reading values back
The reverse conversion is automatic. Index values read from DocuWare are exposed on
DocumentFieldData->value already cast to the matching PHP type:
| DocuWare type | PHP type on ->value |
|---|---|
Int |
int |
Decimal |
float |
Date / DateTime |
Carbon |
String / Memo / Keyword(s) |
string |
Table |
Collection<TableRowData> (each row is a Collection<string, DocumentFieldData>) |
Immutable data & withers
Every response is an immutable spatie/laravel-data object:
Enums
| Enum | Cases |
|---|---|
TargetFileType |
AUTO, PDF, ORIGINAL |
DialogType |
SEARCH, STORE, RESULT, INDEX, LIST, FOLDERS |
DocuWareFieldTypeEnum |
STRING, INT, DECIMAL, DATE, DATETIME, TABLE |
Grant |
Credentials, TrustedUser, Token |
Encrypted document URLs
Endpoint catalog
The resources above are the public API. Under the hood they send Saloon requests that map 1:1 to
DocuWare Platform REST endpoints. This catalog documents that internal mapping for transparency and
advanced use. Paths are relative to <DOCUWARE_URL>/{platform_path}/ (default DocuWare/Platform).
Cached = the request implements Saloon's Cacheable (TTL from configurations.cache.*).
All 68 endpoints across 25 groups
### Authentication βΊ OAuth | Request | Method | Endpoint | Returns | Cached | Inputs | |---|---|---|---|---|---| | `GetIdentityServiceConfiguration` | GET | `{identityServiceUrl}/.well-known/openid-configuration` | `IdentityServiceConfiguration` | yes | identityServiceUrl | | `GetResponsibleIdentityService` | GET | `Data object (DTO) reference
Responses are mapped into immutable *Data objects under CodebarAg\DocuWare\Data. The most-used
shapes and their properties:
Document data objects
### `DocumentData` β `Data\Documents\DocumentData` | Property | Type | Notes | | --- | --- | --- | | `id` | `int` | Document identifier | | `title` | `string` | Document title | | `file_size` | `int` | Bytes | | `total_pages` | `int` | Page count | | `extension` | `?string` | File extension | | `content_type` | `string` | MIME type | | `file_cabinet_id` | `string` | Cabinet id | | `created_at` / `updated_at` | `Carbon` | Timestamps | | `fields` | `?CollectionFile cabinets, dialogs & sections
### `FileCabinetInformationData` β `Data\FileCabinets\FileCabinetInformationData` | Property | Type | Notes | | --- | --- | --- | | `id` / `name` / `color` | `string` | Identity | | `isBasket` / `usable` / `default` | `bool` | Flags | | `versionManagement` | `string` | Version management mode | | `hasFullTextSupport` | `bool` | Full-text search enabled | | `addIndexEntriesInUpperCase` | `bool` | Upper-cases index entries | | `fields` | `?array` | Field metadata | ### `FileCabinetData` β `Data\Organization\FileCabinetData` Lighter cabinet shape returned by `fileCabinets()->all()` (id, name, color, isBasket, usable, defaultβ¦). ### `DialogData` β `Data\FileCabinets\DialogData` | Property | Type | Notes | | --- | --- | --- | | `id` / `type` / `label` | `string` | Identity & dialog type | | `isDefault` | `bool` | Default dialog | | `fileCabinetId` | `string` | Owning cabinet | | `fields` | `?array` | Raw fields; `fieldObjects()` returns typed `DialogFieldData` | ### `DialogFieldData` β `Data\FileCabinets\DialogFieldData` `dbName`, `label`, `type`, `length`, `precision`, `locked`, `readOnly`, `notEmpty`, `visible`, `usedAsDocumentName`, plus select-list metadata. ### `SectionData` β `Data\SectionData` `id`, `contentType`, `pageCount`, `fileSize`, `originalFileName`, `haveMorePages`, `contentModified`, `links`, `pages`, `thumbnails`.Organization & user management
### `OrganizationData` β `Data\Organization\OrganizationData` `id`, `name`, `guid`, `additionalInfo`, `configurationRights`, `isTwoStepVerificationEnabled`, `isTwoStepVerificationRequired`, `links`. ### `UserData` β `Data\Users\UserData` `id`, `name`, `firstName`, `lastName`, `email`, `dbName`, `active`, `isHighSecurity`, `defaultWebBasket`, `outOfOffice`, `regionalSettings`, `twoStepVerificationEnabled`, `links`. ### `GroupData` β `Data\Users\GroupData` `id`, `name`, `active`, `links`. ### `RoleData` β `Data\Users\RoleData` `id`, `name`, `active`, `type`, `links`.Caching
GET metadata and search requests implement Saloon's Cacheable (see the Cached column in the
endpoint catalog). Cached responses use the configurations.cache.driver store with a TTL of
configurations.cache.lifetime_in_seconds. Set the lifetime to 0 to disable caching. Search requests
honor a per-call force-refresh; write operations are never cached.
Error handling
Operations return data or throw β there is no error-carrying result object. Every package exception
descends from DocuWareException, so you can catch the base type to handle any DocuWare failure, or a
specific subclass for a specific status.
| Exception | When |
|---|---|
AuthenticationException |
401 |
BadRequestException |
400 |
ForbiddenException |
403 |
NotFoundException |
404 |
MethodNotAllowedException |
405 |
ConflictException |
409 |
ValidationException |
422 |
RateLimitException |
429 |
ConnectionException |
network/transport failure |
RequestException / DocuWareException |
any other 4xx / 5xx |
Each exception exposes redacted, structured context for logging and reporting:
| Member | Description |
|---|---|
statusCode |
HTTP status code |
instance |
Which DocuWare instance produced it |
docuwareMessage |
The DocuWare error message |
requestId |
Correlation id for support |
context() |
Full redacted context array |
Secrets are never present in any exception message or context.
Events
ResponseReceivedβ a redacted snapshot (instance, method, path, status, request id). The body is attached only whendocuware.debug.capture_bodiesis enabled, and is redacted even then.TokenRefreshedβ instance + url, no secret.
Security
- Structural redaction:
Authorization, passwords, tokens, cookies, and the passphrase are stripped from every log, event, and exception. An architecture test asserts no sentinel secret can leak. - Token store: access tokens are
Crypt-encrypted, namespaced per instance, and refreshed under a cache lock to avoid stampedes.
Testing
In your own app, fake DocuWare with Saloon's mock client, or assert against the recorded fixtures under
tests/Fixtures/saloon.
Credits
- Sebastian BΓΌrgin-Fix
- codebar Solutions AG
- Ricoh Schweiz AG
- All Contributors
License
The MIT License (MIT). See License File for more information.
All versions of laravel-docuware with dependencies
guzzlehttp/guzzle Version ^7.11.1
illuminate/contracts Version ^13.0
illuminate/support Version ^13.0
nesbot/carbon Version ^3.11.4
saloonphp/cache-plugin Version ^3.1
saloonphp/laravel-plugin Version ^4.3.0
saloonphp/rate-limit-plugin Version ^2.0
saloonphp/saloon Version ^4.0
spatie/laravel-data Version ^4.0
spatie/laravel-package-tools Version ^1.93.1