| src | ||
| .editorconfig | ||
| .gitignore | ||
| .gitkeep | ||
| apiConfig.readonly.json | ||
| changelog.md | ||
| composer.json | ||
| composer.lock | ||
| license.md | ||
| phpcs.xml | ||
| readme.md | ||
LDC DAM api
Api client for DAM V2
Client version must match DAM version !!
Installation
Multiple ways are possible. You may include the client directly into your project using composer. You will need to have access to this repos. If you read this it may already be the case. So using composer update or composer require ldc/damclient should be enough.
This has few dependencies it may not interfer with your project.
"ext-curl": "*^7.3*",
"php": ">=7.3",
"guzzlehttp/guzzle": "^7.4",
"respect/validation": "^2.2",
"kwaadpepper/enum": "^2.0"
Usage
As for initialisation multiple ways are possible. If you are in a laravel project you can map a singleton of the dam api.
Using Laravel
-
Setup
config/dam.php<?php return [ 'endpoint' => 'https://ldc-dam.ldc.fr', 'public' => 'YOUR_API_TOKEN', 'private' => 'YOUR_API_PASSWORD' ]; -
Make a dam singleton if needed (optional)
// In AppServiceProvider.php App::singleton('DamApi', function () { return new DamApi(); }); // You then like this. /** @var \LDC\DAM\Client\DamApi $damApi */ $damApi = app('DamApiV2); // Or directly use static methods. /** @var \LDC\DAM\Client\Models\Media|null $media */ $media = Media::find('id');
Using any other project
Setup once the main class (it is already a singleton, no need to manage it).
Informations will be kept in memory as static meaning all instance of DamApi or any class (Media, ..) will share the same informations as credentials.
$damPublicToken = 'YOUR_API_PUBLIC_TOKEN';
$damPrivateToken = 'YOUR_API_PRIVATE_TOKEN';
// This has to hapen once. It will be kept in memory;
new DamApi('https://dam.lesidc.com', $damPublicToken, $damPrivateToken);
Using custom implementation and calling directly DAM
You may implement your own call to fit your needs. If you wish to go this way please read this.
Change log
Please see the changelog for more information on what has changed recently.
Testing
All unit test are included in the dam source code, meaning you do not have access to them. If you wish you can override any source code, write your own test, but data will still be validated on dam side.
Credits
License
MIT. Please see the license file for more information.