Skip to content

🎥 Make videos programmatically with React

php best practices

Jonny Burgerc313ef2a9353
diff --git a/packages/it-tests/src/monorepo/php-package.test.ts b/packages/it-tests/src/monorepo/php-package.test.ts
index 08055cd438..b92af9a8df 100644
--- a/packages/it-tests/src/monorepo/php-package.test.ts
+++ b/packages/it-tests/src/monorepo/php-package.test.ts
@@ -64,7 +64,7 @@ class Semantic
execSync("php composer.phar --quiet install", {
cwd: path.join(process.cwd(), "..", "lambda-php"),
});
- const phpOutput = execSync("phpunit ./src/PHPClientTest.php", {
+ const phpOutput = execSync("phpunit ./tests/PHPClientTest.php", {
cwd: path.join(process.cwd(), "..", "lambda-php"),
});
const output = phpOutput.toString().split("\n");
@@ -127,8 +127,6 @@ class Semantic
).toEqual(removeUndefined(nativeVersion));
});
- // Skip PHP tests temporarily
- // https://github.com/shivammathur/setup-php/issues/823
test("PHP package should create the same progress payload as normal Lambda package", async () => {
execSync("php composer.phar --quiet update", {
cwd: path.join(process.cwd(), "..", "lambda-php"),
@@ -136,7 +134,7 @@ class Semantic
execSync("php composer.phar --quiet install", {
cwd: path.join(process.cwd(), "..", "lambda-php"),
});
- const phpOutput = execSync("phpunit ./src/PHPRenderProgressTest.php", {
+ const phpOutput = execSync("phpunit ./tests/PHPRenderProgressTest.php", {
cwd: path.join(process.cwd(), "..", "lambda-php"),
});
const output = phpOutput.toString().split("\n");
diff --git a/packages/lambda-php/phpunit.xml b/packages/lambda-php/phpunit.xml
new file mode 100644
index 0000000000..78f5d8b85c
--- /dev/null
+++ b/packages/lambda-php/phpunit.xml
@@ -0,0 +1,3 @@
+<phpunit bootstrap="vendor/autoload.php">
+ <!-- Other configurations -->
+</phpunit>
diff --git a/packages/lambda-php/src/PHPClient.php b/packages/lambda-php/src/PHPClient.php
index 09ff2a8972..eba3eccafa 100644
--- a/packages/lambda-php/src/PHPClient.php
+++ b/packages/lambda-php/src/PHPClient.php
@@ -92,12 +92,19 @@ class PHPClient
{
$response = json_decode($response, true);
+ // AWS response
if (isset($response->errorMessage)) {
throw new Exception($response->errorMessage);
}
$classResponse = new RenderMediaOnLambdaResponse();
+
+ // Remotion response
+ if ($response['type'] === 'error') {
+ throw new Exception($response['message']);
+ }
$classResponse->type = $response['type'];
+ print_r(json_encode($response));
$classResponse->renderId = $response['renderId'];
$classResponse->bucketName = $response['bucketName'];
return $classResponse;
diff --git a/packages/lambda-php/src/Version.php b/packages/lambda-php/src/Version.php
new file mode 100644
index 0000000000..1f513b9888
--- /dev/null
+++ b/packages/lambda-php/src/Version.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace RemotionLambdaPhp;
+
+class Semantic
+{
+ public const VERSION = "4.0.146";
+}
\ No newline at end of file