From acf115afe087ff56efc3daea24ce3ebec96daa7f Mon Sep 17 00:00:00 2001 From: Bartosz Date: Wed, 10 Jun 2026 15:18:46 +0200 Subject: [PATCH] Use released castle/castle-php ^4.0 - Require `castle/castle-php` `^4.0` (resolved from the SDK Git tags via the existing VCS repository) instead of the pre-release `feat/php-namespaces` branch. - Configure the request timeout with `Castle::setRequestTimeout(5000)` in place of the removed `Castle::setCurlOpts`. - Update the install note in the README accordingly. --- README.md | 9 ++++----- composer.json | 2 +- src/helpers.php | 8 +++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0287ba3..29794ec 100644 --- a/README.md +++ b/README.md @@ -51,12 +51,11 @@ Install the PHP dependencies, including the Castle PHP SDK: composer install ``` -> **Note:** until the SDK 4.0 release lands on Packagist, `composer.json` pulls -> `castle/castle-php` from the `feat/php-namespaces` branch via a VCS repository. -> If Composer hits a GitHub API rate limit while resolving it, add a token: +> **Note:** `composer.json` requires the released `castle/castle-php` `^4.0`, +> resolved from the SDK's Git tags via a VCS repository. Once `4.0` is available +> on Packagist, the `repositories` block can be dropped. If Composer hits a +> GitHub API rate limit while resolving it, add a token: > `composer config --global github-oauth.github.com ` (or `gh auth token`). -> After the SDK is released, switch the requirement to a tagged version -> (e.g. `"castle/castle-php": "^4.0"`) and drop the `repositories` block. The Castle browser SDK is served at runtime straight from `node_modules`, so install the npm dependencies too: diff --git a/composer.json b/composer.json index 0e438d7..fa08ff7 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "php": ">=7.4", "ext-curl": "*", "ext-json": "*", - "castle/castle-php": "dev-feat/php-namespaces" + "castle/castle-php": "^4.0" }, "require-dev": { "phpunit/phpunit": "^9.6" diff --git a/src/helpers.php b/src/helpers.php index 56aecfd..a0e978a 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -61,11 +61,9 @@ function castle_configure(): void { Castle::setApiKey(env('castle_api_secret')); - // Set connection / request timeouts (milliseconds). - Castle::setCurlOpts([ - CURLOPT_CONNECTTIMEOUT_MS => 3000, - CURLOPT_TIMEOUT_MS => 5000, - ]); + // Set the request timeout in milliseconds (applies to both the connection + // and the transfer). + Castle::setRequestTimeout(5000); } // ---------------------------------------------------------------------------