Skip to content

🎥 Make videos programmatically with React

upgrade PHP SDK

Jonny Burger970b25ee17ee
diff --git a/packages/lambda-php-example/composer.lock b/packages/lambda-php-example/composer.lock
index 1e58109004..8f8a12fcad 100644
--- a/packages/lambda-php-example/composer.lock
+++ b/packages/lambda-php-example/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "ffb5b2fdeada4081119003d23235d314",
+ "content-hash": "13e96a9a4f950ff3249fb068965a7fc1",
"packages": [
{
"name": "aws/aws-crt-php",
@@ -62,16 +62,16 @@
},
{
"name": "aws/aws-sdk-php",
- "version": "3.271.1",
+ "version": "3.276.4",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
- "reference": "707552cfb1fa37e8e501d2c70afa9bc2e61104c0"
+ "reference": "80509b932c7e8e917a5026a89bd7af1f2b34ed59"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/707552cfb1fa37e8e501d2c70afa9bc2e61104c0",
- "reference": "707552cfb1fa37e8e501d2c70afa9bc2e61104c0",
+ "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/80509b932c7e8e917a5026a89bd7af1f2b34ed59",
+ "reference": "80509b932c7e8e917a5026a89bd7af1f2b34ed59",
"shasum": ""
},
"require": {
@@ -151,9 +151,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
- "source": "https://github.com/aws/aws-sdk-php/tree/3.271.1"
+ "source": "https://github.com/aws/aws-sdk-php/tree/3.276.4"
},
- "time": "2023-05-24T18:20:35+00:00"
+ "time": "2023-07-24T18:15:58+00:00"
},
{
"name": "graham-campbell/result-type",
@@ -880,11 +880,11 @@
},
{
"name": "remotion/lambda",
- "version": "3.3.96",
+ "version": "4.0.10",
"dist": {
"type": "path",
"url": "../lambda-php",
- "reference": "35f4f068f71c3687fbe9e25c2b93cf86c7f850bc"
+ "reference": "e9197b639c0085ec910e8e2ac61a5b3e4c8d720e"
},
"require": {
"aws/aws-sdk-php": "^3.269"
@@ -908,16 +908,16 @@
},
{
"name": "symfony/deprecation-contracts",
- "version": "v3.2.1",
+ "version": "v3.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
- "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e"
+ "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e",
- "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e",
+ "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf",
+ "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf",
"shasum": ""
},
"require": {
@@ -926,7 +926,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "3.3-dev"
+ "dev-main": "3.4-dev"
},
"thanks": {
"name": "symfony/contracts",
@@ -955,7 +955,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1"
+ "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0"
},
"funding": [
{
@@ -971,7 +971,7 @@
"type": "tidelift"
}
],
- "time": "2023-03-01T10:25:55+00:00"
+ "time": "2023-05-23T14:45:45+00:00"
},
{
"name": "symfony/polyfill-ctype",
diff --git a/packages/lambda-php-example/src/render.php b/packages/lambda-php-example/src/render.php
index 3241c00ac3..6fd5d0249d 100644
--- a/packages/lambda-php-example/src/render.php
+++ b/packages/lambda-php-example/src/render.php
@@ -1,4 +1,5 @@
<?php
+use Aws\Credentials\CredentialProvider;
// We'll assume you use Composer, which will add autoload.php
require_once dirname(__DIR__) . '/vendor/autoload.php';
@@ -8,7 +9,8 @@ use Remotion\LambdaPhp\PHPClient;
use Remotion\LambdaPhp\RenderParams;
// Load environment variables
-$dotenv = Dotenv::createImmutable(__DIR__);
+// 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"
@@ -18,8 +20,11 @@ $functionName = $_ENV['REMOTION_APP_FUNCTION_NAME'];
// Specify the URL to your Webpack bundle
$serveUrl = $_ENV['REMOTION_APP_SERVE_URL'];
+
+$provider = CredentialProvider::defaultProvider();
+
// Instantiate the client
-$client = new PHPClient($region, $serveUrl, $functionName, null);
+$client = new PHPClient($region, $serveUrl, $functionName, $provider);
// Initiate the param object and customize as needed
$params = new RenderParams();
diff --git a/packages/lambda-php/src/PHPClient.php b/packages/lambda-php/src/PHPClient.php
index 6b436cfbfe..ed53d9f388 100644
--- a/packages/lambda-php/src/PHPClient.php
+++ b/packages/lambda-php/src/PHPClient.php
@@ -1,12 +1,12 @@
<?php
namespace Remotion\LambdaPhp;
+use Aws\Credentials\CredentialProvider;
use Aws\Lambda\LambdaClient;
use Exception;
use stdClass;
require_once __DIR__ . '/Version.php';
-use VERSION;
class PHPClient
{
@@ -15,10 +15,10 @@ class PHPClient
private $serveUrl;
private $functionName;
- public function __construct(string $region, string $serveUrl, string $functionName, ? array $credential)
+ public function __construct(string $region, string $serveUrl, string $functionName, ? callable $credential)
{
- $this->client = LambdaClient::factory([
- 'version' => 'latest',
+ $this->client = new LambdaClient([
+ 'version' => '2015-03-31',
'region' => $region,
'credentials' => $credential,
]);