This package was developed to give you a quick start to communicate with the DocuWare REST API. It is used to query the most common endpoints.
- π‘ What is DocuWare?
- π Requirements
- βοΈ Installation
- π Usage
- Extending the connector (EXAMPLE)
- πΌ Make encrypted URLs
- ποΈ Document Index Fields DTO showcase
- π¦ Caching requests
- π₯ Exceptions explained
- β¨ Events
- π§ Configuration file
- π§ Testing
- π Changelog
- βοΈ Contributing
- π§βπ» Security Vulnerabilities
- π Credits
- π License
DocuWare provides cloud document management and workflow automation software that enables you to digitize, secure and work with business documents, then optimize the processes that power the core of your business.
Version Support
Version | PHP Version | Laravel Version | DocuWare Cloud Access |
---|---|---|---|
> v11.0 (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.* | β |
Current Support
Group | Request | Supported | TODO |
---|---|---|---|
Authentication/OAuth | 1. Get Responsible Identity Service | β | |
Authentication/OAuth | 2. Get Identity Service Configuration | β | |
Authentication/OAuth | 3.a Request Token w/ Username & Password | β | |
Authentication/OAuth | 3.b Request Token w/ a DocuWare Token | π£ | |
Authentication/OAuth | 3.c Request Token w/ Username & Password (Trusted User) | π£ | |
Authentication/OAuth | 3.d.1 Obtain Windows Authorization (On Premises Only) | π£ | |
Authentication/OAuth | 3.d.2 Request Token /w a Windows Account (On Premises Only) | π£ | |
General/Organisation | Get Login Token | β | |
General/Organisation | Get Organization | β | |
General/Organisation | Get All File Cabinets and Document Trays | β | |
General/UserManagement | Get Users by ID | β | |
General/UserManagement | Get Users of a Role | β | |
General/UserManagement | Get Users of a Group | β | |
General/UserManagement | Create User | β | |
General/UserManagement | Update User | β | |
General/UserManagement | Get Groups | β | |
General/UserManagement | Get All Groups for a Specific User | β | |
General/UserManagement | Add User to a Group | β | |
General/UserManagement | Remove User from a Group | β | |
General/UserManagement | Get Roles | β | |
General/UserManagement | Get All Roles for a Specific User | β | |
General/UserManagement | Add User to a Role | β | |
General/UserManagement | Remove User from a Role | β | |
FileCabinets/General | Get File Cabinet Information | β | |
FileCabinets/General | Get Total Number of Documents | β | |
FileCabinets/Dialogs | Get All Dialogs | β | |
FileCabinets/Dialogs | Get a Specific Dialog | β | |
FileCabinets/Dialogs | Get Dialogs of a Specific Type | β | |
FileCabinets/Search | Get Documents from a File Cabinet | β | |
FileCabinets/Search | Get a Specific Document From a File Cabinet | β | |
FileCabinets/Search | Search for Documents in a Single File Cabinet | β | |
FileCabinets/Search | Search for Documents in Multiple File Cabinets | β | |
FileCabinets/CheckInCheckOut | Check-out & Download a Document | π£ | |
FileCabinets/CheckInCheckOut | Check-in a Document from the File System | π£ | |
FileCabinets/CheckInCheckOut | Undo Check-out | π£ | |
FileCabinets/SelectLists | Get Select Lists & Get Filtered Select Lists | β | |
FileCabinets/Upload | Create Data Record | β | |
FileCabinets/Upload | Append File(s) to a Data Record | β | |
FileCabinets/Upload | Upload a Single File for a Data Record | β | - |
FileCabinets/Upload | Create a Data Record & Upload File | β | - |
FileCabinets/Upload | Create Data Record & Upload File Using Store Dialog | β | - |
FileCabinets/Upload | Append a Single PDF to a Document | β | - |
FileCabinets/Upload | Replace a PDF Document Section | β | - |
FileCabinets/BatchIndexFieldsUpdate | Batch Update Index Fields By Id | β | - |
FileCabinets/BatchIndexFieldsUpdate | Batch Update Index Fields By Search | β | - |
FileCabinets/BatchIndexFieldsUpdate | Batch Append/Update Keyword Fields By Id | β | - |
Documents/UpdateIndexValues | Update Index Values | β | |
Documents/UpdateIndexValues | Update Table Field Values | β | - ? |
Documents/ModifyDocuments | Transfer Document | β | |
Documents/ModifyDocuments | Delete Document | β | |
Documents/ClipUnclip&StapleUnstaple | Clip | β | |
Documents/ClipUnclip&StapleUnstaple | Unclip | β | |
Documents/ClipUnclip&StapleUnstaple | Staple | β | |
Documents/ClipUnclip&StapleUnstaple | Unstaple | β | |
Documents/AnnotationsStamps | AddStampWithPosition | π£ | |
Documents/AnnotationsStamps | AddStampWithBestPosition | π£ | |
Documents/AnnotationsStamps | AddTextAnnotation | π£ | |
Documents/AnnotationsStamps | AddRectEntryAnnotation | π£ | |
Documents/AnnotationsStamps | AddLineEntryAnnotation | π£ | |
Documents/AnnotationsStamps | AddPolyLineEntryAnnotation | β | - |
Documents/AnnotationsStamps | DeleteAnnotation | β | - |
Documents/AnnotationsStamps | UpdateTextAnnotation | π£ | |
Documents/AnnotationsStamps | Get Stamps | β | - |
Documents/DocumentsTrashBin | Get Documents | β | |
Documents/DocumentsTrashBin | Delete Documents | β | |
Documents/DocumentsTrashBin | Restore Documents | β | |
Documents/ApplicationProperties | Get Application Properties | β | |
Documents/ApplicationProperties | Add Application Properties | β | |
Documents/ApplicationProperties | Delete Application Properties | β | |
Documents/ApplicationProperties | Update Application Properties | β | |
Documents/Sections | Get All Sections from a Document | β | |
Documents/Sections | Get a Specific Section | β | |
Documents/Sections | Delete Section | β | |
Documents/Sections/Textshot | Get Textshot for a Specific Section | β | |
Documents/Download | Download Document | β | |
Documents/Download | Download Section | β | |
Documents/Download | Download Thumbnail | β | |
Workflow | Get Document Workflow History | β | |
Workflow | Get Document Workflow History Steps | β |
You can install the package via composer:
composer require codebar-ag/laravel-docuware
Add the following environment variables to your .env
file:
DOCUWARE_URL=https://domain.docuware.cloud
DOCUWARE_USERNAME=user@domain.test
DOCUWARE_PASSWORD=password
DOCUWARE_PASSPHRASE="passphrase"
With the passphrase we are able to encrypt the URLs.
# β Passphrase contains a backslash and is not escaped:
DOCUWARE_PASSPHRASE="a#bcd>2~C1'abc\#"
# β
We need to escape the backslash with another backslash:
DOCUWARE_PASSPHRASE="a#bcd>2~C1'abc\\#"
This package automatically handles the generation of OAuth token for you and stores them in cache.
use CodebarAg\DocuWare\Connectors\DocuWareConnector;
use CodebarAg\DocuWare\DTO\Config\ConfigWithCredentials;
$connector = new DocuWareConnector(
configuration: new ConfigWithCredentials(
username: 'username',
password: 'password',
)
);
use CodebarAg\DocuWare\Connectors\DocuWareConnector;
use CodebarAg\DocuWare\DTO\Config\ConfigWithCredentialsTrustedUser;
$connector = new DocuWareConnector(
configuration: new ConfigWithCredentialsTrustedUser(
username: 'username',
password: 'password',
impersonatedUsername: 'impersonatedUsername',
)
);
We understand it may be repetitive to pass the configuration every time you create a new connector.
You can extend the connector and set the configuration once.
<?php
namespace App\Connectors;
use CodebarAg\DocuWare\Connectors\DocuWareConnector;
use CodebarAg\DocuWare\DTO\Config\ConfigWithCredentials;
class YourOwnDocuWareConnector extends DocuWareConnector
{
public function __construct() {
$configuration = new ConfigWithCredentials(
username: 'username',
password: 'password',
);
parent::__construct($configuration);
}
}
use App\Connectors\YourOwnDocuWareConnector;
use CodebarAg\DocuWare\DTO\Config\ConfigWithCredentials;
$connector = new YourOwnDocuWareConnector();
The Following events will be fired:
use CodebarAg\DocuWare\Events\DocuWareResponseLog;
// Log each response from the DocuWare REST API.
DocuWareResponseLog::class => [
//
],
You can publish the config file with:
php artisan vendor:publish --provider="CodebarAg\DocuWare\DocuWareServiceProvider" --tag="docuware-config"
This is the contents of the published config file:
<?php
return [
/*
|--------------------------------------------------------------------------
| Cache driver
|--------------------------------------------------------------------------
| You may like to define a different cache driver than the default Laravel cache driver.
|
*/
'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
/*
|--------------------------------------------------------------------------
| Requests timeout
|--------------------------------------------------------------------------
| This variable is optional and only used if you want to set the request timeout manually.
|
*/
'timeout' => env('DOCUWARE_TIMEOUT', 15),
/*
|--------------------------------------------------------------------------
| DocuWare Credentials
|--------------------------------------------------------------------------
|
| Before you can communicate with the DocuWare REST-API it is necessary
| to enter your credentials. You should specify a url containing the
| scheme and hostname. In addition add your username and password.
|
*/
'credentials' => [
'url' => env('DOCUWARE_URL'),
'username' => env('DOCUWARE_USERNAME'),
'password' => env('DOCUWARE_PASSWORD'),
],
/*
|--------------------------------------------------------------------------
| Passphrase
|--------------------------------------------------------------------------
|
| In order to create encrypted URLs we need a passphrase. This enables a
| secure exchange of DocuWare URLs without anyone being able to modify
| your query strings. You can find it in the organization settings.
|
*/
'passphrase' => env('DOCUWARE_PASSPHRASE'),
/*
|--------------------------------------------------------------------------
| Configurations
|--------------------------------------------------------------------------
|
*/
'configurations' => [
'search' => [
'operation' => 'And',
/*
* Force Refresh
* Determine if result list is retrieved from the cache when ForceRefresh is set
* to false (default) or always a new one is executed when ForceRefresh is set to true.
*/
'force_refresh' => true,
'include_suggestions' => false,
'additional_result_fields' => [],
],
'cache' => [
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
'lifetime_in_seconds' => env('DOCUWARE_CACHE_LIFETIME_IN_SECONDS', 60),
],
],
];
Copy your own phpunit.xml-file.
cp phpunit.xml.dist phpunit.xml
Modify environment variables in the phpunit.xml-file:
<env name="DOCUWARE_TOKEN" value=""/>
<env name="DOCUWARE_URL" value="https://domain.docuware.cloud"/>
<env name="DOCUWARE_USERNAME" value="user@domain.test"/>
<env name="DOCUWARE_PASSWORD" value="password"/>
<env name="DOCUWARE_PASSPHRASE" value="passphrase"/>
<env name="DOCUWARE_TIMEOUT" value="30"/>
<env name="DOCUWARE_CACHE_LIFETIME_IN_SECONDS" value="0"/>
<env name="DOCUWARE_TESTS_FILE_CABINET_ID" value=""/>
<env name="DOCUWARE_TESTS_DIALOG_ID" value=""/>
<env name="DOCUWARE_TESTS_BASKET_ID" value=""/>
<env name="DOCUWARE_TESTS_ORGANIZATION_ID" value=""/>
Run the tests:
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
- Sebastian Fix
- Rhys Lees
- All Contributors
- Skeleton Repository from Spatie
- Laravel Package Training from Spatie
The MIT License (MIT). Please see License File for more information.