A PHP client for WoodWing Assets
WoodWing Assets is a DAM (Digital Asset Management) system. This PHP client library uses its REST API.
This is not an official library supplied by the WoodWing vendor. It has been developed during the WoodWing Assets implementation at the German SPIEGEL Gruppe, 2019-2020.
Functionality
- API login
- Search:
SearchRequest
- Browse:
BrowseRequest
- Create:
CreateRequest
- Update:
UpdateRequest
- Update bulk:
UpdateBulkRequest
- Copy asset:
CopyAssetRequest
- Move / rename:
MoveRequest
- Remove:
RemoveRequest
- Create relation:
CreateRelationRequest
- Create folder:
CreateFolderRequest
- Get folder metadata:
GetFolderRequest
- Update folder metadata:
UpdateFolderRequest
Installation
Use Composer to add this library your project’s composer.json file:
$ composer require der-spiegel/ww-elvis-client
Quick test
Here’s how to do a quick test, starting from scratch with a new project (Docker required):
Install dependencies using Composer
$ mkdir MyExample && cd MyExample
$ docker run --rm --interactive --tty \
--volume $PWD:/app \
--volume ${COMPOSER_HOME:-$HOME/.composer}:/tmp \
composer/composer require der-spiegel/ww-elvis-client monolog/monolog
Copy and edit the example script
$ cp vendor/der-spiegel/ww-elvis-client/UsageExample.php MyExample.php
Edit your copy, setting the correct Assets URL, username (API user preferred) and password in this section:
$assetsConfig = new AssetsConfig(
'https://assets.example.com/', // Assets URL (without app/ or services/ postfix)
'username', // Assets user name (API user preferred)
'password' // That user's password
);
The example script performs a simple search across all assets (visible for that user) and returns the first 50 asset IDs – you can leave it as is for a first test:
$assetsClient = new AssetsClient($assetsConfig, $logger); // Create client
$request = (new SearchRequest($assetsConfig)) // Create search request
->setQ('') // Assets query
->setMetadataToReturn(['']); // Metadata fields to return
$response = $assetsClient->search($request); // Perform search
foreach ($response->getHits() as $assetResponse) { // Loop through results
echo $assetResponse->getId() . "\n"; // Access asset metadata
}
Then run your copy
$ docker run -it --rm --name assets-client-example \
--volume "$PWD":/usr/src/myapp --workdir /usr/src/myapp \
php:cli php MyExample.php
Authors
License
This library is licensed under the MIT License - see the LICENSE
file for details.