Capítulo 488 de 988

Chapter 488: Triggering renders from PHP

Core Idea

_available from v3. 3.

Key Concepts

  • Cancelling a render<AvailableFrom v="4.0.515" />
  • Changelog
  • See also

Code Examples

<?php
use Aws\Credentials\CredentialProvider;

// We'll assume you use Composer, which will add autoload.php
require_once dirname(__DIR__) . '/vendor/autoload.php';

use Dotenv\Dotenv;
use Remotion\LambdaPhp\PHPClient;
use Remotion\LambdaPhp\RenderParams;

// Load environment variables
// Use "unsafe" because AWS reads environment variables from getenv(), not $_ENV
$dotenv = Dotenv::createUnsafeImmutable(__DIR__);
$dotenv->load();

// Specify the region you deployed to, for example "us-east-1"
$region = getenv('REMOTION_APP_REGION');
// Specify the function you would like to call
$functionName = getenv('REMOTION_APP_FUNCTION_NAME');
// Specify the URL to your Webpack bundle
$serveUrl = getenv('REMOTION_APP_SERVE_URL');

$provider = CredentialProvider::defaultProvider();

// Instantiate the client
$client = new PHPClient($region, $serveUrl, $functionName, $provider);

// Initiate the param object and customize as needed
$params = new RenderParams();

$params->setComposition('react-svg');

// Set input props
$params->setInputProps(['message' => 'yo whats up']);

// Execute the render and get the response

$renderResponse = $client->renderMediaOnLambda($params);

// Output render response
print_r($renderResponse);

// Get render progress
$renderId = $renderResponse->renderId;
$bucketName = $renderResponse->bucketName;

$renderProgressResponse = $client->getRenderProgress($renderId
// ...(truncated)
  • What it demonstrates: Usage pattern for Triggering renders from PHP from the official docs.

Key Takeaways

  1. Understand cancelling a render<availablefrom v="4.0.515" /> when working with Triggering renders from PHP.
  2. Understand changelog when working with Triggering renders from PHP.
  3. Understand see also when working with Triggering renders from PHP.

Connects To

  • api: related page in the Lambda (@remotion/lambda) section.
  • Approuterwebhook: related page in the Lambda (@remotion/lambda) section.
  • Authentication: related page in the Lambda (@remotion/lambda) section.