# LDC DAM api Api client for DAM V2 **Client version must match DAM version !!** - [LDC DAM api](#ldc-dam-api) - [**Installation**](#installation) - [**Usage**](#usage) - [**Using Laravel**](#using-laravel) - [**Using any other project**](#using-any-other-project) - [**Using Wordpress**](#using-wordpress) - [**Using custom implementation and calling directly DAM**](#using-custom-implementation-and-calling-directly-dam) - [**More information**](#more-information) - [**Customer Informations**](#customer-informations) - [**Change log**](#change-log) - [**Testing**](#testing) - [**Credits**](#credits) - [**License**](#license) ## **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** 1. Setup ``config/dam.php`` 'https://ldc-dam.ldc.fr', 'public' => 'YOUR_API_TOKEN', 'private' => 'YOUR_API_PASSWORD' ]; 2. 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](docs/src/routes.json). ## **Change log** Please see the [changelog](changelog.md) 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** - [Jérémy Munsch](https://jeremydev.ovh) ## **License** MIT. Please see the [license file](license.md) for more information.