🎥 Make videos programmatically with React
`remotion/lambda-php`: Delete vendor and code refactor
Jonny Burger908d8c8a9c6f
diff --git a/packages/it-tests/src/monorepo/php-package.test.ts b/packages/it-tests/src/monorepo/php-package.test.tsindex 832609a172..08055cd438 100644--- a/packages/it-tests/src/monorepo/php-package.test.ts+++ b/packages/it-tests/src/monorepo/php-package.test.ts@@ -15,7 +15,16 @@ describe("These should run serially", () => {test("Set the right version for phpunit", () => {expect(typeof version).toBe("string");- const VERSION = `<?php \nnamespace Remotion\\LambdaPhp;\n\nconst VERSION = "${version}";`;+ const VERSION = `+<?php++namespace Remotion\LambdaPhp;++class Semantic+{+ public const VERSION = "${version}";+}+ `.trim();writeFileSync(path.join(process.cwd(), "..", "lambda-php", "src", "Version.php"),VERSIONdiff --git a/packages/lambda-php/.gitignore b/packages/lambda-php/.gitignoreindex ae9fd2b7af..04ee5f32b7 100644--- a/packages/lambda-php/.gitignore+++ b/packages/lambda-php/.gitignore@@ -1,20 +1,3 @@-# Ignore cache files-/var/cache/*--# Ignore log files-/var/log/*--# Ignore configuration files-/config/*.ini-/config/*.yml-/config/*.xml--# Ignore vendor directory-/vendor/*--# Ignore compiled files-/compiled/*--# Ignore temporary files-*.tmp-*.temp+vendor/+.phpunit.result.cache+.idea/diff --git a/packages/lambda-php/composer.json b/packages/lambda-php/composer.jsonindex b9cffdf776..23ca16656d 100644--- a/packages/lambda-php/composer.json+++ b/packages/lambda-php/composer.json@@ -1,12 +1,13 @@{"name": "remotion/lambda","type": "library",- "version": "4.0.146",+ "version": "4.0.145","description": "A PHP library for working with Remotion Lambda","license": "proprietary","autoload": {"psr-4": {- "Remotion\\LambdaPhp\\": "src/"+ "Remotion\\LambdaPhp\\": "src/",+ "Remotion\\LambdaPhp\\Tests\\": "tests/"}},"require": {@@ -14,5 +15,8 @@},"require-dev": {"phpunit/phpunit": "^10.1"+ },+ "scripts": {+ "test": "phpunit tests"}}diff --git a/packages/lambda-php/src/Exceptions.php b/packages/lambda-php/src/Exceptions.phpdeleted file mode 100644index 79d377cce1..0000000000--- a/packages/lambda-php/src/Exceptions.php+++ /dev/null@@ -1,8 +0,0 @@-<?php--namespace Remotion\LambdaPhp;--use Exception;--class ValidationException extends Exception-{}diff --git a/packages/lambda-php/src/GetRenderProgressResponse.php b/packages/lambda-php/src/GetRenderProgressResponse.phpindex 94e74bc0a4..4dab3d034b 100644--- a/packages/lambda-php/src/GetRenderProgressResponse.php+++ b/packages/lambda-php/src/GetRenderProgressResponse.php@@ -4,7 +4,7 @@ namespace Remotion\LambdaPhp;class GetRenderProgressResponse{- public int $chunks;+ public ?int $chunks;public bool $done;public float $overallProgress;public string $type;diff --git a/packages/lambda-php/src/PHPClient.php b/packages/lambda-php/src/PHPClient.phpindex 15c4fb3650..09ff2a8972 100644--- a/packages/lambda-php/src/PHPClient.php+++ b/packages/lambda-php/src/PHPClient.php@@ -1,20 +1,16 @@<?phpnamespace Remotion\LambdaPhp;-use Remotion\LambdaPhp\GetRenderProgressResponse;-use Aws\Credentials\CredentialProvider;use Aws\Lambda\LambdaClient;use Exception;use stdClass;-require_once __DIR__ . '/Version.php';-class PHPClient{- private $client;- private $region;- private $serveUrl;- private $functionName;+ protected $client;+ protected $region;+ protected $serveUrl;+ protected $functionName;public function __construct(string $region, string $serveUrl, string $functionName, ?callable $credential){@@ -62,7 +58,7 @@ class PHPClient'renderId' => $renderId,'bucketName' => $bucketName,'type' => 'status',- "version" => VERSION,+ "version" => Semantic::VERSION,"s3OutputProvider" => null,"logLevel" => $logLevel ,);diff --git a/packages/lambda-php/src/RenderMediaOnLambdaResponse.php b/packages/lambda-php/src/RenderMediaOnLambdaResponse.phpnew file mode 100644index 0000000000..dbfb6d9de7--- /dev/null+++ b/packages/lambda-php/src/RenderMediaOnLambdaResponse.php@@ -0,0 +1,10 @@+<?php++namespace Remotion\LambdaPhp;++class RenderMediaOnLambdaResponse+{+ public string $type;+ public string $bucketName;+ public string $renderId;+}\ No newline at end of filediff --git a/packages/lambda-php/src/RenderParams.php b/packages/lambda-php/src/RenderParams.phpindex 93f71def48..6dbd3e51fb 100644--- a/packages/lambda-php/src/RenderParams.php+++ b/packages/lambda-php/src/RenderParams.php@@ -1,108 +1,98 @@<?php+namespace Remotion\LambdaPhp;-require_once __DIR__ . '/Version.php';use stdClass;-use VERSION;--class RenderMediaOnLambdaResponse-{- public string $type;- public string $bucketName;- public string $renderId;-}-class RenderParams{-- private $data = null;- private $bucketName = null;- private $region = null;- private $outName = null;- private $composition = null;- private $serverUrl = null;- private $framesPerLambda = null;-- private $codec = 'h264';- private $version = "";- private $imageFormat = 'jpeg';- private $crf = null;- private $envVariables = [];- private $maxRetries = 1;- private $jpegQuality = 80;- private $privacy = 'private';- private $colorSpace = 'default';- private $logLevel = 'info';- private $frameRange = null;- private $timeoutInMilliseconds = 30000;- private $chromiumOptions = null;- private $scale = 1;- private $everyNthFrame = 1;- private $numberOfGifLoops = 0;- private $concurrencyPerLambda = 1;- private $downloadBehavior = [+ protected $data = null;+ protected $bucketName = null;+ protected $region = null;+ protected $outName = null;+ protected $composition = null;+ protected $serverUrl = null;+ protected $framesPerLambda = null;++ protected $codec = 'h264';+ protected $version = "";+ protected $imageFormat = 'jpeg';+ protected $crf = null;+ protected $envVariables = [];+ protected $maxRetries = 1;+ protected $jpegQuality = 80;+ protected $privacy = 'privacy';+ protected $colorSpace = 'default';+ protected $logLevel = 'info';+ protected $frameRange = null;+ protected $timeoutInMilliseconds = 30000;+ protected $chromiumOptions = null;+ protected $scale = 1;+ protected $everyNthFrame = 1;+ protected $numberOfGifLoops = 0;+ protected $concurrencyPerLambda = 1;+ protected $downloadBehavior = ['type' => 'play-in-browser',];- private $muted = false;- private $preferLossless = false;- private $overwrite = false;- private $audioBitrate = null;- private $videoBitrate = null;- private $encodingBufferSize = null;- private $maxRate = null;- private $webhook = null;- private $forceHeight = null;- private $forceWidth = null;- private $offthreadVideoCacheSizeInBytes = null;- private $audioCodec = null;- private $rendererFunctionName = null;- private $proResProfile = null;- private $pixelFormat = null;- private $x264Preset = null;- private $deleteAfter = null;-+ protected $muted = false;+ protected $preferLossless = false;+ protected $overwrite = false;+ protected $audioBitrate = null;+ protected $videoBitrate = null;+ protected $encodingBufferSize = null;+ protected $maxRate = null;+ protected $webhook = null;+ protected $forceHeight = null;+ protected $forceWidth = null;+ protected $offthreadVideoCacheSizeInBytes = null;+ protected $audioCodec = null;+ protected $rendererFunctionName = null;+ protected $proResProfile = null;+ protected $pixelFormat = null;+ protected $x264Preset = null;+ protected $deleteAfter = null;+public function __construct(- ?array $data = null,+ ?array $data = null,?string $composition = 'main',- string $codec = 'h264',+ string $codec = 'h264',?string $version = null,- string $imageFormat = 'jpeg',- ?int $crf = null,- ?array $envVariables = null,- int $maxRetries = 1,- int $jpegQuality = 80,- string $privacy = 'public',- string $colorSpace = 'default',- string $logLevel = 'info',+ string $imageFormat = 'jpeg',+ ?int $crf = null,+ ?array $envVariables = null,+ int $maxRetries = 1,+ int $jpegQuality = 80,+ string $privacy = 'public',+ string $colorSpace = 'default',+ string $logLevel = 'info',?string $frameRange = null,?string $outName = null,- ?int $timeoutInMilliseconds = 30000,- ?object $chromiumOptions = null,- ?int $scale = 1,- ?int $everyNthFrame = 1,- ?int $numberOfGifLoops = 0,- ?int $concurrencyPerLambda = 1,- ?array $downloadBehavior = null,- ?bool $muted = false,- ?bool $overwrite = false,- ?int $audioBitrate = null,- ?int $videoBitrate = null,- ?string $webhook = null,- ?int $forceHeight = null,- ?int $forceWidth = null,- ?int $offthreadVideoCacheSizeInBytes = null,- ?string $audioCodec = null,- ?int $framesPerLambda = null,- ?string $rendererFunctionName = null,- ?string $proResProfile = null,+ ?int $timeoutInMilliseconds = 30000,+ ?object $chromiumOptions = null,+ ?int $scale = 1,+ ?int $everyNthFrame = 1,+ ?int $numberOfGifLoops = 0,+ ?int $concurrencyPerLambda = 1,+ ?array $downloadBehavior = null,+ ?bool $muted = false,+ ?bool $overwrite = false,+ ?int $audioBitrate = null,+ ?int $videoBitrate = null,+ ?string $webhook = null,+ ?int $forceHeight = null,+ ?int $forceWidth = null,+ ?int $offthreadVideoCacheSizeInBytes = null,+ ?string $audioCodec = null,+ ?int $framesPerLambda = null,+ ?string $rendererFunctionName = null,+ ?string $proResProfile = null,?string $pixelFormat = null,?string $x264Preset = null,?string $deleteAfter = null,?string $encodingBufferSize = null,?string $maxRate = null,- ?bool $preferLossless = false- )+ ?bool $preferLossless = false+ ){if ($chromiumOptions === null) {$this->chromiumOptions = new stdClass();@@ -150,6 +140,7 @@ class RenderParams}private array $inputProps = array();+public function serializeParams(){$parameters = [@@ -176,7 +167,7 @@ class RenderParams'downloadBehavior' => $this->getDownloadBehavior(),'muted' => $this->getMuted(),'preferLossless' => $this->getPreferLossless(),- 'version' => VERSION,+ 'version' => Semantic::VERSION,'overwrite' => $this->getOverwrite(),'audioBitrate' => $this->getAudioBitrate(),'videoBitrate' => $this->getVideoBitrate(),@@ -451,7 +442,7 @@ class RenderParamsreturn $this;}- /**+ /*** Get the value of jpegQuality*/public function getJpegQuality()@@ -491,7 +482,7 @@ class RenderParamsreturn $this;}- /**+ /*** Get the value of colorspace*/public function getColorSpace()@@ -530,6 +521,7 @@ class RenderParamsreturn $this;}+// Setter methodspublic function setFrameRange($frameRange){@@ -627,6 +619,7 @@ class RenderParams{$this->muted = $muted;}+// Setter methodspublic function setPreferLossless($preferLossless){@@ -718,6 +711,7 @@ class RenderParams{return $this->forceWidth;}+public function getOffthreadVideoCacheSizeInBytes(){return $this->offthreadVideoCacheSizeInBytes;@@ -850,8 +844,8 @@ class RenderParamspublic function setX264Preset($x264Preset){- $this->x264Preset = $x264Preset;- return $this;+ $this->x264Preset = $x264Preset;+ return $this;}public function getDeleteAfter()@@ -861,7 +855,7 @@ class RenderParamspublic function setDeleteAfter($deleteAfter){- $this->$deleteAfter = $deleteAfter;- return $this;+ $this->deleteAfter = $deleteAfter;+ return $this;}}diff --git a/packages/lambda-php/src/Semantic.php b/packages/lambda-php/src/Semantic.phpnew file mode 100644index 0000000000..701e8bc274--- /dev/null+++ b/packages/lambda-php/src/Semantic.php@@ -0,0 +1,8 @@+<?php++namespace Remotion\LambdaPhp;++class Semantic+{+ public const VERSION = "4.0.145";+}diff --git a/packages/lambda-php/src/Version.php b/packages/lambda-php/src/Version.phpdeleted file mode 100644index e3cf44fe5c..0000000000--- a/packages/lambda-php/src/Version.php+++ /dev/null@@ -1,4 +0,0 @@-<?php-namespace Remotion\LambdaPhp;--const VERSION = "4.0.146";\ No newline at end of filediff --git a/packages/lambda-php/src/PHPClientTest.php b/packages/lambda-php/tests/PHPClientTest.phpsimilarity index 84%rename from packages/lambda-php/src/PHPClientTest.phprename to packages/lambda-php/tests/PHPClientTest.phpindex d0d3fad6d8..56ce2ba127 100644--- a/packages/lambda-php/src/PHPClientTest.php+++ b/packages/lambda-php/tests/PHPClientTest.php@@ -1,8 +1,6 @@<?php-require_once dirname(__DIR__) . '/vendor/autoload.php';-require_once __DIR__ . '/PHPClient.php';-require_once __DIR__ . '/RenderParams.php';+namespace Remotion\LambdaPhp\Tests;use PHPUnit\Framework\TestCase;use Remotion\LambdaPhp\PHPClient;diff --git a/packages/lambda-php/src/PHPRenderProgressTest.php b/packages/lambda-php/tests/PHPRenderProgressTest.phpsimilarity index 73%rename from packages/lambda-php/src/PHPRenderProgressTest.phprename to packages/lambda-php/tests/PHPRenderProgressTest.phpindex 4830766795..b7b6b8b567 100644--- a/packages/lambda-php/src/PHPRenderProgressTest.php+++ b/packages/lambda-php/tests/PHPRenderProgressTest.php@@ -1,12 +1,9 @@<?php-require_once dirname(__DIR__) . '/vendor/autoload.php';-require_once __DIR__ . '/PHPClient.php';-require_once __DIR__ . '/RenderParams.php';+namespace Remotion\LambdaPhp\Tests;use PHPUnit\Framework\TestCase;use Remotion\LambdaPhp\PHPClient;-use Remotion\LambdaPhp\RenderParams;class PHPRenderProgressTest extends TestCase{