From 85b427d1f6c2d7074950c2b02a9731491e3f8a60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 06:02:07 +0000 Subject: [PATCH 1/3] chore(internal): php cs fixer should not be memory limited --- .php-cs-fixer.dist.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e01ea3b..d46a37f 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -4,6 +4,8 @@ use PhpCsFixer\Finder; use PhpCsFixer\Runner\Parallel\ParallelConfigFactory; +ini_set('memory_limit', -1); + return (new Config) ->setParallelConfig(ParallelConfigFactory::detect()) ->setFinder(Finder::create()->in([__DIR__.'/src', __DIR__.'/tests'])) From 648193c0d5db24aec73e908a6415342059106763 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 06:06:13 +0000 Subject: [PATCH 2/3] feat: use `$_ENV` aware getenv helper --- src/Client.php | 16 +++++++++++----- src/Core/Util.php | 17 +++++++++++++++++ tests/Services/SessionsTest.php | 3 ++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/Client.php b/src/Client.php index 53824c2..267d660 100644 --- a/src/Client.php +++ b/src/Client.php @@ -37,11 +37,17 @@ public function __construct( ?string $baseUrl = null, RequestOptions|array|null $requestOptions = null, ) { - $this->browserbaseAPIKey = (string) ($browserbaseAPIKey ?? getenv('BROWSERBASE_API_KEY')); - $this->browserbaseProjectID = (string) ($browserbaseProjectID ?? getenv('BROWSERBASE_PROJECT_ID')); - $this->modelAPIKey = (string) ($modelAPIKey ?? getenv('MODEL_API_KEY')); - - $baseUrl ??= getenv( + $this->browserbaseAPIKey = (string) ($browserbaseAPIKey ?? Util::getenv( + 'BROWSERBASE_API_KEY' + )); + $this->browserbaseProjectID = (string) ($browserbaseProjectID ?? Util::getenv( + 'BROWSERBASE_PROJECT_ID' + )); + $this->modelAPIKey = (string) ($modelAPIKey ?? Util::getenv( + 'MODEL_API_KEY' + )); + + $baseUrl ??= Util::getenv( 'STAGEHAND_BASE_URL' ) ?: 'https://api.stagehand.browserbase.com'; diff --git a/src/Core/Util.php b/src/Core/Util.php index 4d355ea..58e82aa 100644 --- a/src/Core/Util.php +++ b/src/Core/Util.php @@ -25,6 +25,23 @@ final class Util public const JSONL_CONTENT_TYPE = '/^application\/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)/'; + public static function getenv(string $key): ?string + { + if (array_key_exists($key, array: $_ENV)) { + if (!is_string($value = $_ENV[$key])) { + throw new \InvalidArgumentException; + } + + return $value; + } + + if (is_string($value = getenv($key))) { + return $value; + } + + return null; + } + /** * @return array */ diff --git a/tests/Services/SessionsTest.php b/tests/Services/SessionsTest.php index 18cb4e2..ab14125 100644 --- a/tests/Services/SessionsTest.php +++ b/tests/Services/SessionsTest.php @@ -6,6 +6,7 @@ use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Stagehand\Client; +use Stagehand\Core\Util; use Stagehand\Sessions\SessionActResponse; use Stagehand\Sessions\SessionEndResponse; use Stagehand\Sessions\SessionExecuteResponse; @@ -28,7 +29,7 @@ protected function setUp(): void { parent::setUp(); - $testUrl = getenv('TEST_API_BASE_URL') ?: 'http://127.0.0.1:4010'; + $testUrl = Util::getenv('TEST_API_BASE_URL') ?: 'http://127.0.0.1:4010'; $client = new Client( browserbaseAPIKey: 'My Browserbase API Key', browserbaseProjectID: 'My Browserbase Project ID', From eeadabe4a7135b7c9287df296a30a8479c553f22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 06:06:46 +0000 Subject: [PATCH 3/3] release: 3.14.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ README.md | 2 +- src/Version.php | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0fef13b..75e8a66 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.13.1" + ".": "3.14.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b1fed8..2a900c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 3.14.0 (2026-02-03) + +Full Changelog: [v3.13.1...v3.14.0](https://github.com/browserbase/stagehand-php/compare/v3.13.1...v3.14.0) + +### Features + +* use `$_ENV` aware getenv helper ([648193c](https://github.com/browserbase/stagehand-php/commit/648193c0d5db24aec73e908a6415342059106763)) + + +### Chores + +* **internal:** php cs fixer should not be memory limited ([85b427d](https://github.com/browserbase/stagehand-php/commit/85b427d1f6c2d7074950c2b02a9731491e3f8a60)) + ## 3.13.1 (2026-01-31) Full Changelog: [v3.13.0...v3.13.1](https://github.com/browserbase/stagehand-php/compare/v3.13.0...v3.13.1) diff --git a/README.md b/README.md index 0387c84..8d748e7 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ The REST API documentation can be found on [docs.stagehand.dev](https://docs.sta ``` -composer require "browserbase/stagehand 3.13.1" +composer require "browserbase/stagehand 3.14.0" ``` diff --git a/src/Version.php b/src/Version.php index d18f2ae..6df3c37 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace Stagehand; // x-release-please-start-version -const VERSION = '3.13.1'; +const VERSION = '3.14.0'; // x-release-please-end