https://github.com/doverunner/drm-license-token-sample-php
Sample codes to generate DRM license token for Doverunner multi-DRM integration
https://github.com/doverunner/drm-license-token-sample-php
drm fairplay php playready widevine wiseplay
Last synced: 4 months ago
JSON representation
Sample codes to generate DRM license token for Doverunner multi-DRM integration
- Host: GitHub
- URL: https://github.com/doverunner/drm-license-token-sample-php
- Owner: doverunner
- Created: 2025-06-24T03:36:36.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2026-01-19T23:08:55.000Z (5 months ago)
- Last Synced: 2026-02-03T06:40:20.037Z (4 months ago)
- Topics: drm, fairplay, php, playready, widevine, wiseplay
- Language: PHP
- Homepage: https://doverunner.com
- Size: 76.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DoveRunner Token Sample - PHP (v3.1.0)
## Overview
This repository provides server-side sample code that can generate license token for DoveRunner multi-DRM service. DRM license tokens are used to authenticate license requests in multi-DRM integration workflows.
Here's how a license token works in the DRM license issuance process.
- When a multi-DRM client tries to play DRM content, the client requests a token to the content service platform to acquire DRM license. The service platform verifies that the user requesting the token has permission to the content, and then generates a token data according to the specification.
- The service platform can set usage rights and various security policies in the token data. The generated token is delivered to the client as response.
- When the client requests a DRM license with the token, DoveRunner cloud server validates the token and issues a license.
## Documentation
- [DoveRunner Docs](https://doverunner.com/docs/)
## Environment
- PHP Version 8.4.7 or later.
- Install Composer to use autoloader.
## Configuration
Before running the sample code, you need to configure your DoveRunner credentials.
1. Copy the example configuration file:
```bash
cp tests/config/config.php.example tests/config/config.php
```
2. Edit `tests/config/config.php` and fill in your credentials:
```php
'your-site-id',
'siteKey'=> 'your-site-key',
'accessKey'=> 'your-access-key',
// User and Content Identifiers (required)
'userId'=> 'test-user',
'cid'=> 'test-cid'
];
```
3. Get your credentials from [DoveRunner Console](https://console.doverunner.com)
**Note**: `config.php` is excluded from version control for security. Never commit sensitive credentials to the repository.
## Quick Example
tests/SampleTest.php
```php
playbackPolicy($playbackPolicyRequest)
//->securityPolicy($securityPolicyRequest)
->build();
/* Create token */
// siteId, accessKey, siteKey, userId, cid, policy is required.
// https://doverunner.com/docs/content-security/multi-drm/license/license-token/#token-json-example
$result = $DoverunnerTokenClient
->playReady()
->siteId($config["siteId"])
->accessKey($config["accessKey"])
->siteKey($config["siteKey"])
->userId($config["userId"])
->cid($config["cid"])
->policy($policyRequest)
->execute();
}catch (DoverunnerTokenException $e){
$result = $e->toString();
}
echo $result;
?>
ExternalKeyRequest
```
## Support
If you have any questions or issues with the token sample, please create a ticket at [DoveRunner Helpdesk](https://support.doverunner.com) website.