Coder Social home page Coder Social logo

ww_assets_php_client's Introduction

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

Installation

Use Composer to add this library your project’s composer.json file:

$ composer require der-spiegel/ww-assets-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-assets-client monolog/monolog

Copy and edit the example script

$ cp vendor/der-spiegel/ww-assets-client/UsageExample.php MyExample.php

Edit your copy, setting the correct Assets URL, username (API user preferred) and password in this section:

$assetsConfig = AssetsConfig::create(
    '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($assetsClient,               // Create search request
        q: '',                                            // Assets query
        metadataToReturn: ['']                            // Metadata fields to return
);

$response = $request();                                   // Perform search

foreach ($response->hits as $assetResponse) {             // Loop through results
    echo $assetResponse->id . "\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

Development

See Running tests for instructions on how to run unit and integration tests.

To regenerate the documentation in docs/_build/html from the source files, run Sphinx:

$ docker run --rm --volume "$PWD":/usr/src/myapp --workdir /usr/src/myapp/docs sphinxdoc/sphinx:5.3.0 make html

Authors

License

This library is licensed under the MIT License - see the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.