A PHP library for interacting with the ORF Live2VOD system, providing API clients, domain objects, webhook handling, and DRM token generation.
This package provides a complete SDK for the ORF Live2VOD system, including:
- HTTP client for session management
- Domain value objects (Clip, Session, Form, Marker, etc.)
- Webhook event handling and factories
- DRM token generation
- Request/Response DTOs for API communication
- Foundry factories for testing
This package is intended to be installed via Composer:
composer require sensiolabs-de/live2vod-apiuse SensioLabs\Live2Vod\Api\Client;
use SensioLabs\Live2Vod\Api\SessionApi;
use SensioLabs\Live2Vod\Api\Domain\Api\Request\CreateSessionRequest;
use SensioLabs\Live2Vod\Api\Domain\Identifier\SessionId;
use Symfony\Component\HttpClient\HttpClient;
// Initialize the client
$httpClient = HttpClient::create();
$client = new Client($httpClient, 'https://api.example.com');
$sessionApi = new SessionApi($client);
// Create a session
$request = new CreateSessionRequest(/* ... */);
$response = $sessionApi->create($request);
// Get session details
$session = $sessionApi->get($response->id);
// Delete a session
$sessionApi->delete($response->id);use SensioLabs\Live2Vod\Api\Domain\Identifier\ClipId;
use SensioLabs\Live2Vod\Api\Domain\Clip\Status;
use SensioLabs\Live2Vod\Api\Domain\Session\Form\Field\StringField;
use SensioLabs\Live2Vod\Api\Domain\Session\Form\Fields;
use SensioLabs\Live2Vod\Api\Domain\Session\Form\Name;
use SensioLabs\Live2Vod\Api\Domain\Session\Form\Label;
// Create identifiers
$clipId = ClipId::fromString('01HQX...');
// Create form fields
$field = new StringField(
name: new Name('title'),
label: new Label('Video Title'),
required: true,
);
$fields = Fields::fromArray([
['type' => 'string', 'name' => 'title', 'label' => 'Title', 'required' => true],
['type' => 'textarea', 'name' => 'description', 'label' => 'Description'],
]);use SensioLabs\Live2Vod\Api\Webhook\WebhookEventFactory;
use SensioLabs\Live2Vod\Api\Domain\Webhook\Event\ClipCompletedEvent;
$factory = new WebhookEventFactory();
// Parse webhook payload
$event = $factory->createFromPayload($webhookPayload);
if ($event instanceof ClipCompletedEvent) {
// Handle clip completed event
$clipId = $event->clipId;
$sessionId = $event->sessionId;
}use SensioLabs\Live2Vod\Api\DRM\TokenGenerator;
use SensioLabs\Live2Vod\Api\Domain\DRM\GeoLocation;
$tokenGenerator = new TokenGenerator('your-secret-key');
$token = $tokenGenerator->generate(
sessionId: $sessionId,
clipId: $clipId,
geoLocation: GeoLocation::AT,
expiresAt: new \DateTimeImmutable('+1 hour')
);HTTP client wrapper for making API requests with customizable HTTP client support.
High-level API for session management:
create(CreateSessionRequest)- Create new sessionget(SessionId)- Retrieve session detailsdelete(SessionId)- Delete session
Null object implementation for testing/development.
CreateSessionRequest- DTO for session creation
CreateSessionResponse- Response after session creationSessionResponse- Complete session details
Generate DRM tokens for protected content access.
Token- DRM token value object with expirationGeoLocation- Geographic location enum for geo-blocking
Factory for creating webhook event objects from payloads.
ClipCreatedEvent- Fired when clip is createdClipCompletedEvent- Fired when clip processing completesClipUpdatedEvent- Fired when clip is updatedClipErrorEvent- Fired when clip processing failsClipDeletedEvent- Fired when clip is deletedClipsCompletedEvent- Fired when all session clips completeClipsFailedEvent- Fired when session clips failSessionDeletedEvent- Fired when session is deleted
Event- Base webhook event interfaceClip- Clip representation in webhooksPayload\ClipStatusCallbackPayload- Payload for clip status callbacksPayload\ClipDeletedCallbackPayload- Payload for clip deletion callbacks
AssetsFactory- Creates clip assets from API responsesCreateSessionRequestFactory- Creates session requestsSessionConfigFactory- Creates session configurationsTokenFactory- Creates DRM tokensWebhook\WebhookEventFactory- Creates webhook events
ClipId- ULID-based identifier for clipsSessionId- ULID-based identifier for sessionsMarkerId- ULID-based identifier for markersIdTrait- Shared trait for identifier value objects
Status- Enum for clip status (created, recording, completed, failed)StreamType- Enum for stream types (HLS, DASH, MP4)Assets- Collection of clip assets (streams and files)Stream- Stream asset with URL and typeFile- File asset with URL, type, and bitrateBitrate- Value object for bitrate (e.g., 1080p, 720p)FileType- Enum for file types (MP4, etc.)Filepath- Value object for file pathsThumbnail- Thumbnail URL value objectFormData- Dynamic form data for clips
Type- Enum for marker types (chapter, advertisement, intro, blackfade, mute, beitrag)
Config- Session configurationChannel- Channel identifierForm- Dynamic form configurationFormConfig- Form configuration wrapper
Name,Label,Placeholder,Help,Description- String value objects for form metadataIcon- Icon identifier for UI elementsEndpoint- URL endpoint for form submission or actionsFieldType- Enum for field types (STRING, TEXTAREA, SELECT, NUMBER, DATE, etc.)ActionOn- Enum for action triggers (CHANGE, etc.)Field- Base form fieldFields- Collection of form fields with validation and type-safe accessButton- Form button definitionButtons- Collection of form buttonsAction- Dynamic field actionActions- Collection of dynamic field actions
StringField- Text input with validation (minLength, maxLength, pattern)TextareaField- Multi-line text inputNumberField- Numeric input with min/max validationDateField- Date inputDateTimeField- DateTime inputSelectField- Single select dropdownMultiSelectField- Multiple select dropdownBooleanField- Checkbox/toggleImageField- Image upload fieldUrlField- URL input with validation
Title- Title value objectUrl- URL value object with validation
Exception\InvalidUrlException- Thrown for invalid URLsDomain\Clip\Exception\FileNotFoundException- Thrown when file not foundDomain\Session\Form\Exception\FieldNotFoundException- Thrown when accessing non-existent fieldDomain\Session\Form\Exception\FieldTypeMismatchException- Thrown when field type doesn't match expected type
The package includes Foundry factories for easy test data generation:
- Located in
src/Factory/namespace - Integrated with
zenstruck/foundryfor seamless testing - Use in your tests to create realistic mock data
The Domain objects in this package are automatically synchronized from the main ORF Live2VOD repository using .github/sync-live2vod-api.sh.
Sync Configuration:
The sync script uses key-value mappings to copy directories:
SYNC_MAPPINGS=(
"src/Domain:live2vod-api/src/Domain"
)To customize sync behavior, edit the mappings in .github/sync-live2vod-api.sh. Supports:
- Directory mappings:
"src/Domain:live2vod-api/src/Domain" - File mappings with renaming:
"src/Domain/Foo.php:live2vod-api/src/Domain/Bar.php"
How it works:
- Copies all files from
src/Domain/recursively - Transforms namespaces from
App\DomaintoSensioLabs\Live2Vod\Api\Domain - Updates all use statements to reference the new namespace
- Validates PHP 8.1 syntax compatibility with
php -l - Auto-detects and copies missing dependencies
- Can be run manually:
bash .github/sync-live2vod-api.sh
PHP 8.1 Validation:
The sync script automatically validates all copied files for PHP 8.1 compatibility:
- Runs
php -lsyntax check on every file - Catches PHP 8.2+ features like readonly classes
- Exits with error if any file fails validation
- Ensures package maintains PHP 8.1.2+ compatibility
This package is automatically split into the sensiolabs-de/live2vod-api repository using GitHub Actions.
Workflow Configuration:
The split workflow (.github/workflows/split-live2vod-api.yaml) triggers on push to develop when live2vod-api/ files change:
on:
push:
branches:
- develop
paths:
- 'live2vod-api/**'Setup Requirements:
- Create GitHub Personal Access Token with repository write access
- Add as repository secret:
LIVE2VOD_API_SPLIT_TOKEN - Workflow uses
symplify/github-action-monorepo-splitto extract subtree - Pushes to
sensiolabs-de/live2vod-apirepository onmainbranch
Manual Split (Alternative):
If GitHub Actions unavailable, use git subtree:
cd orf-live2vod
git subtree split --prefix=live2vod-api -b live2vod-api-split
cd ../live2vod-api
git pull ../orf-live2vod live2vod-api-split
git push origin mainOr use splitsh-lite for better performance:
splitsh-lite --prefix=live2vod-api/ --origin=develop --target=refs/heads/main
git push [email protected]:sensiolabs-de/live2vod-api.git refs/heads/main- PHP 8.1.2 or higher
- oskarstark/enum-helper ^1.8
- oskarstark/trimmed-non-empty-string ^1.9
- symfony/http-kernel ^6.4 || ^7.0
- symfony/uid ^6.4 || ^7.0
- thecodingmachine/safe ^3.0
- webmozart/assert ^1.11
- zenstruck/foundry ^2.7.5
Proprietary